This is just a test repo to try different Git and Github related things out.
Sometimes I want to actually rewind a few steps in the repo history, usually for tidiness. Note that this is permanent!
- Do a hard reset to a specific commit id
git reset --hard 1234abc
- Local will now say that there are commits to pull from origin (github) - do not pull these
- Force push from local to github
git push -f origin master
- Local and origin (github) should now be identical
Often I realise my current work would have been better in a new branch:
- Stash current edits
git stash push
- Create a new branch and unstash edits
git stash branch nameofnewbranch
Often I realise my current work would have been better in a different branch that already exists:
- Stash current edits
git stash push
- Switch to a different branch
- Unstash edits
git stash pop
git stash push -u