how to discard git local branch changes?
eg, local branch with version: A->B->C
Now I am on version A, and it has some changes conflict with latest version C.
I want to discard local changes and pull the latest version C.
$ git pull
I will meet some error. and there are many files, so I don’t need to do many times $ git co files
Is there any better way?
If you have uncommitted changes that you want to discard, use this:
which is equivalent to
This removes all the local uncommitted changes. If you want to remove some offending commits from your local branch, try rewinding it:
or e.g.
Use these with caution, as you won’t be able to undo these operations. Once you’re done cleaning up your local branch, use
git pullto get the latest code.