For Q4 I feel you might be instructing users to do something a bit dangerous with git reset --hard HEAD~1.
If commit C has been pushed anywhere then using the above command local project will result in your local project history being different from upstream. This will cause conflicts if you try to merge later.
If you want to revert a commit that's been pushed it's much safer to use a command like git revert <commit>. This will introduce an extra commit, the reverse of the commit you're attempting to undo.
Though you end up with an extra commit no ones code will be broken, and this can be merged safely to remotes where the C commit might have been pushed.
Thanks for the article Alex.
For Q4 I feel you might be instructing users to do something a bit dangerous with
git reset --hard HEAD~1
.If commit C has been pushed anywhere then using the above command local project will result in your local project history being different from upstream. This will cause conflicts if you try to merge later.
If you want to revert a commit that's been pushed it's much safer to use a command like
git revert <commit>
. This will introduce an extra commit, the reverse of the commit you're attempting to undo.Though you end up with an extra commit no ones code will be broken, and this can be merged safely to remotes where the C commit might have been pushed.
You can read more on the
git revert
command here