Setup a Git Alias for Rolling Back Any Pending Changes

by Bill Beckelman 21. July 2010 22:36

I have a hard time remembering git reset --hard HEAD for some reason when I want to rollback changes to the last commit in my working branch when I go down a path that doesn’t work. Mercurial has an easy to remember command for this hg rollback. Git has a feature called Alias though that you can use to create your own commands. I setup a rollback Alias to mimic the Mercurial command by entering the following into a command prompt:

git config -–global alias.rollback “reset –-hard HEAD”

Tags:

Git


About Me

I live and work in Salt Lake City, Utah. My background is in aviation. I have a degree in Aeronautical Science from Embry-Riddle Aeronautical University in Prescott, AZ. I have worked as a commercial airline pilot and most recently as a technical advisor for a charter airline.