Great tips here, to add on to top #3, instead of having to checkout into another new branch to retain your change, you can actually just do
git reset --soft head~1 (~1 being one commit, so obviously this varies)
Basically, --hard reverts your commits and discards your change, but whereas --soft reverts your commits but retains your change, so you can just checkout to another branch and commit there.
Great tips here, to add on to top #3, instead of having to checkout into another new branch to retain your change, you can actually just do
git reset --soft head~1(~1 being one commit, so obviously this varies)Basically,
--hardreverts your commits and discards your change, but whereas--softreverts your commits but retains your change, so you can just checkout to another branch and commit there.That seems nicer approach. Will give a try. Thanks