0% found this document useful (0 votes)
17 views10 pages

Git Hub Actions For CICD Pipelines

The document summarizes common Git commands for managing source code repositories. It describes commands for initializing a repository with git init, cloning an existing repository with git clone, adding files to the staging area with git add, taking snapshots of changes with git commit, viewing differences with git diff and git diff --staged, checking the status of changes with git status, viewing the version history with git log, listing and switching branches with git branch and git checkout, pushing commits to a remote repository with git push, merging branches with git merge, fetching and merging remote changes with git pull, and temporarily storing modified files with git stash.

Uploaded by

Sai Venkat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views10 pages

Git Hub Actions For CICD Pipelines

The document summarizes common Git commands for managing source code repositories. It describes commands for initializing a repository with git init, cloning an existing repository with git clone, adding files to the staging area with git add, taking snapshots of changes with git commit, viewing differences with git diff and git diff --staged, checking the status of changes with git status, viewing the version history with git log, listing and switching branches with git branch and git checkout, pushing commits to a remote repository with git push, merging branches with git merge, fetching and merging remote changes with git pull, and temporarily storing modified files with git stash.

Uploaded by

Sai Venkat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Git Commands

you should know


git init
This command is used to start a new repository.
Git creates a .git directory

$ git init [repository name]

git clone
This command is used to obtain a repository from
an existing gitHub repo.

$ git clone [repository URL]

linkedin.com/in/bhupendra-singh-315870210
git add
This command is used to add a file to the staging
area.

$ git add [file name]

git add .
This command is used to add all the files to the
staging area.

$ git add .

linkedin.com/in/bhupendra-singh-315870210
git commit
This command takes a snapshot of project's
currently staged changes.

$ git commit -m “[ meaningful message]”

git diff
This command shows the file differences which are
not yet staged.

$ git diff

linkedin.com/in/bhupendra-singh-315870210
git diff –staged
This command shows the differences between files
in the staging area and latest version present.

$ git diff -staged

git status
This command shows all the modified files which
are not committed.

$ git status

linkedin.com/in/bhupendra-singh-315870210
git log
This command shows the list of version history.

$ git log

git branch
This command shows all the branches of repo.

$ git branch

linkedin.com/in/bhupendra-singh-315870210
git checkout
This command is used to switch between branches.

$ git checkout [branch name]

To create new branch and switch to that.

$ git checkout -b [branch name]

linkedin.com/in/bhupendra-singh-315870210
git push
This command sends all committed changes to your
repo.

$ git push origin master

git merge
This command shows all the branches of repo.

$ git merge [branch name]

linkedin.com/in/bhupendra-singh-315870210
git pull
This command fetch and merge changes.

$ git pull [Repository Link]

git stash
This command temporarily stores all the modified
tracked files.

$ git stash save

linkedin.com/in/bhupendra-singh-315870210
Thanks for
Reading

You might also like