git config
Usage: git config -global user.name “[name]”
Usage: git config -global user.email “[email address]”
This command sets the author name and email address respectively to be used with commits.
git clone
Usage: git clone [url]
This command is used to obtain a repository from an existing URL.
git add
Usage: git add [file]
This command adds one or more files to the staging area.
git commit
Usage: git commit -m “message”
This command stores the file permanently in the version history.
git status
shows the current status of the repo. Tracked or untracked files.
git log
shows all the commit history.
git diff
git diff [branch/commit] [branch/commit]
This command shows the differences between the two branches/commits mentioned.
git rm
Usage: git rm [file]
This command deletes the file from your working directory and stages the deletion.
git revert
puts the commit id below the specified commit id on top.
git branch
Usage: git branch [branch name]
This command creates a new branch.
git checkout
goes to the specified branch.
git merge
Usage: git merge [branch name]
This command merges the specified branch’s history into the current branch. we can also pick the merge policy.
git pull
This command does fetch + merge.
git push
pushes the local repo commits to remote repo and to specified branch.
Top comments (0)