GIT Cheat Sheet (All GIT Commands)
GIT Cheat Sheet (All GIT Commands)
Remember |
1. git config
- command: git config –global user.name “[name]”
- command: git config –global user.email “[email address]”
The command sets the author's email and name address to be used with your commits.
git tag
Use: to see the list of tags
2. git init
- command: git init [repository name]
The command is used to start a new repository.
3. git clone
- command: git clone [url]
4. git add
- command: git add [file]
- command: git add *
5. git commit
- command: git commit -m “[ Type in the commit message]”
- command: git commit -a
6. git diff
- command: git diff
- command: git diff –staged
- command: git diff [first branch] [second branch]
7. git status
- command: git status
8. git rm
- command: git rm [file]
9. git log
- command: git log
- command: git log –follow [file]
- git log - -oneline
- git log –grep “message_word”
10. git show
- command: git show [commit]
11. git tag
- command: git tag [commitID]
12. git branch
- command: git branch
The command lists all the local branches in the current repository.
- command: git branch [branch name]
- command: git branch -d [branch name]
- git branch -D <branch_name>
13. git checkout
- command: git checkout [branch name]
- command: git checkout -b [branch name]
14. git merge
- command: git merge [branch name]
12. git remote
- command: git remote add [variable name] [Remote Server Link]
13. git push
- command: git push [variable name] master
- command: git push [variable name] [branch]
- command: git push –all [variable name]
- command: git push [variable name] :[branch name]
14. git pull
- command: git pull [Repository Link]
15. git stash
- command: git stash save
- command: git stash pop
- command: git stash list
- command: git stash drop
16. git reset
- command: git reset [file_name]
Use: The command is used to undo local changes to the staging area
git reset *
git reset *
Use: The command is used to undo all the local changes to the staging area
17. git revert
- command: git revert <commit id>
18. git clean
- command: git clean -n (dry run)
- git clean -f (force fully)
Use: This command will remove all the untracked files
19. adding Tags
- git tag -a <tag_name> -m <message> <commit-id>
git tag
Use: to see the list of tags
- git show<tag_name>
- git tag -d <tag_name>
Thanks & Regards,
Tapan Patni
Email: tapanpatni58@gmail.com
Linkedin: https://www.linkedin.com/in/tapan-patni
BlogSpot: https://tapanpatni58.blogspot.com
Kanchan Soni
Email: kanchansoni.cse@gmail.com
Linkedin: www.linkedin.com/in/soni-kanchan
Instagram: https://www.instagram.com/sonikanchan_
Twitter: https://twitter.com/SoniKanchan_
ice blog.. Thanks for sharing this blog information with us…
ReplyDeleteDevOps Training
DevOps Online Training