These advertisements help me to keep writing articles on this website

Git commands

Are you moving away from your Git client and want to achieve more through Git bash? Here is a nice git command cheat sheet for you.

Undo your work git reset --hard, git clean -fd
Change directory cd /c/folder1/folder2
Show directory ls
Git status git status
Reset one file git checkout -- folder1/folder2/SmallStrategy.cs
Push to branche1 on server git push origin branche1
Stage all modified files git add .
Stage all modified and new files git add -A
Commit git commit -m "Updated project file for Windows 10 RTM"
Show local branches git branch
Show remote branches git remote show origin
Create local branch git checkout -b loek/windows-10-fix
Force delete local branch git branch -D loek/windows-10-fix
Reset to origin/master git reset --hard origin/master
Rebase on master git rebase origin/master
Apply commit fb115 to current branch git cherry-pick fb115
Remove file(s) from git git rm --cached Mahjong/_scale*
Undo the last 13 commits and stage them git reset --soft HEAD~13
Undo Unstaged changes git checkout -- .
Unstage all git reset
Check remote address git remote show origin
Undo last commit git reset HEAD~
Written by Loek van den Ouweland on July 12, 2016. Questions regarding this artice? You can send them to the address below.
By using this site, you acknowledge that you have read and understand our Cookie and Privacy Policy.