Another developer has deleted and rebuilt a remote branch called "development" which I already have a checked out copy. He did this delete and rebuild to remove some cruft from it. Which is great.
But when I do a "git pull origin development" it keeps getting merge conflicts. Yet I don't want what I have in my copy. I want what is in origin only.
So how do I delete my local copy of it and pull it back down? Or at least pull without merging my local information into it?
Grab the most up-to-date changes from the origin remote. This step is the “pull without merge” step you asked for in your question. git pull
is the equivalent of git fetch
followed by git merge
.
git fetch origin
Get to a clean branch if necessary.
git stash
With a clean branch, switch to the development branch if you are not already there.
git checkout development
Finally, force your local development branch to point to the same commit as the one on origin.
git reset --hard origin/development
Always think twice before using git reset --hard
, as with rm -rf
. It is a sharp, useful tool, but it can destroy work if you are not careful.