Wednesday, January 23, 2019

Good way to do git revert

UPDATE: This probably isn't as good:

I have found that doing

git revert --no-commit HEAD~(number of commits back)..

for example:

git revert --no-commit HEAD~3..

and then committing the changes is a great way to revert back to a previous commit without messing up git structure.

UPDATE: This is better:

git reset --hard (hash number) deletes all changes and goes straight to that commit.

git revert (hash number) allows you to merge changes made in that revision with the HEAD

No comments:

Post a Comment