DevMetrix
.
cloud
Home
Tools
Blog
Examples
System Designer
Cheat Sheets
Comparisons
Projects
About
Advertisement
← All Cheat Sheets
Git Commands Cheat Sheet
Essential Git commands for everyday use
Setup & Config
git config --global user.name "[name]"
Set user name
Copy
git config --global user.email "[email]"
Set user email
Copy
git init
Initialize new git repo
Copy
Snapshots & Staging
git status
Current repo status
Copy
git add [file]
Stage a file
Copy
git commit -m 'msg'
Commit with message
Copy
Branches & Merging
git branch
List branches
Copy
git checkout -b [branch]
Create & switch branch
Copy
git merge [branch]
Merge to current branch
Copy
git branch -d [branch]
Delete branch
Copy
Remote
git clone [url]
Clone repo
Copy
git remote -v
Show remotes
Copy
git push origin [branch]
Push to remote
Copy
git pull
Pull latest
Copy
Undo & Clean
git reset --hard
Reset to HEAD
Copy
git revert [commit]
Revert commit
Copy
git clean -fd
Remove untracked
Copy
Advertisement