Nick
Nick

Reputation: 101

Bring branch back to last commit in origin

I accidentally pulled in changes from branch 1 into branch 2. How do I set my local copy of the branch 2 back to the last commit on the origin?

The changes haven't been pushed to the remote repository.

Upvotes: 1

Views: 239

Answers (2)

René Höhle
René Höhle

Reputation: 27295

You can reset to the last state. Use git log search for the last commit id then reset to that commit id with git reset --hard <id>.

Upvotes: 1

Mort
Mort

Reputation: 3549

In each branch you want to go back to the "upstream" version, git reset --hard @{u} (@{u} is short for @{upstream})

Upvotes: 2

Related Questions