Unintended I pull a remote branch feature1
into development
1. git checkout development
2. git pull origin feature1
The branch development
is ahead of origin/development
by N
commits. I can't push changes to origin/development. After pull, I tried run merge --abort
but it did not work.
Is there a way to undo all new changes (commits to push) in a branch in particular?
Issue the following command while branch development
is checked out:
git reset --hard origin/development
This will reset your local development branch to point to the same commit as origin/development (the commit you were on before pull
).
Precautions: Do not use the --hard
option if you have local uncommitted changes you wish to keep.
If you have unpushed commits on your local development branch you wish to keep you should use the commit id of the latest commit on development instead of origin/development
.