Thursday, August 17, 2017

How to undo remove revert previous commits


Step 1

Get the commit hash you would like to remove/revert

Step 2

Do:
git revert 77f8a8d20fe40eac680246f2735e1c320ef42b5c


Step 3

Type message.
Save the file in the editor. If it's Emacs: CTRL X CTRL S to save then CTRL X CTRL C to quit.

On Windows GIT Bash Ctrl+X would do nothing and found out it works quite like vi/vim. Press i to enter inline insert mode. Type the description at the very top, press esc to exit insert mode, then type :x! (now the cursor is at the bottom) and hit enter to save and exit.

If typing :q! instead, will exit the editor without saving (and commit will be aborted)

Step 4
git push


No comments:

Post a Comment