Thursday, December 8, 2016

Clean Up Your Git Mess - 1

1. Want to stash uncommitted changes
git stash
2. No, the changes are not tracked (untracked changes)
git add . # all the changes in ./ directory (pwd)
git stash # now do this
3. Want to undo the last stash
git stash pop
4. Again?
git stash pop # its a stack, you got the idea
5. Want to clear the stack
git stash clear
6. Want to know more about stash? https://git-scm.com/docs/git-stash
7. You type password every time you need to push something on remote ref. It sucks.
git config --global credential.helper cache
8. Revert local head upto last nth commit
git reset --hard HEAD~nth
9. Take remote head to some commit because all the commits after this particular commit are wrong?
git push origin +: