Undo Last Comment With Git

Using git is a great way to develop software. You version your development process. In addition, if you want to switch to the previous version or comment during development, you can handle such situations very easily.

Now I will show you how you can do this with a nice method when you want to undo the last git comment you made.

Here we will define the undo comment as an alias to make it easier for your future use.

We can normally do this with the following command:

git reset --soft HEAD~1

 

You can turn this long command into an alias with the command I will give you below:

git config --global alias.uncommit 'reset --soft HEAD~1'

 

So from now on, when you want to get your comments back, just run the following command:

git uncommit

 

Finally, you can use the following command to see the list of all the aliases you have added:

git config --list | grep alias

 

See you soon.

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *