LXT
LXT

Reputation: 855

How to redo git pull?

For example, I am working on branch1 and I want to 'git pull' code from branch2. However, I 'git pull' code from branch3 instead of branch2. How can I redo the 'git pull' command? (delete the code from branch2)

Upvotes: 1

Views: 316

Answers (2)

Kajal Kumari
Kajal Kumari

Reputation: 11

You can use

git reset --hard <commit-id>

(kindly commit your code before that, --hard will make you loose the uncommitted changes)

Upvotes: 1

VonC
VonC

Reputation: 1329712

If you just pulled, as described in "Undo git pull, how to bring repos to old state", a simple git reset --hard custom-branch@{1} should be enough, assuming you have no work in prigress (or it would be lost, erased by the reset --hard)

You can then git fetch, and git merge origin/anyBranchYouNeed, to make the pull you want.

Upvotes: 1

Related Questions