Convenient Git Command to Discard Local Changes
In order to discard all local commits on a branch, that is, to make the local branch identical to the upstream of the branch, run:
git reset --hard @{u}
where @{u}
is the short form of @{upstream}
and denotes the upstream branch.
Written on January 22, 2017 by alistairmckinnell