Discard Local Changes in Git


To discard local changes in Git instead of merging, for instance after editing a file without remembering to run a `git pull` first, use the following commands:

kjones@la01-01-fs~/configurations/metroswitch/dialplan/default
> git fetch origin
kjones@la01-01-fs~/configurations/metroswitch/dialplan/default
> git reset --hard origin/master
HEAD is now at add5ec6 adding 10686

Link to the stackoverflow thread where I found out about these commands:



Comments:


Gravatar of Kyle Jones

Knowledge Base is a repository for various notes, guides, and thoughts on a wide range of IT related topics. Read more...

Sponsored By:


Web development services by Say Web Solutions. Visit website.