3/13/2018 - 5:40 AM

Git Cheatsheet

Git Cheatsheet

Common Gitcommands

Remove last commit and put all changes in staged area

While working on many things, many a times you have some half done work meanwhile another IMPORTANT issues comes in between. So you commit the current WIP thing, switch to a new branch and continue the work. Not when you come back you want to remove the last commit and put the changes in the unstanged area (as if you never got the IMPORTANT issue in between)

git reset --soft HEAD^
# or
git reset HEAD^

Remove branches that were removed from origin from local repo also

git fetch --prune