开发者

Git pull needs to discard local files

开发者 https://www.devze.com 2023-01-20 10:06 出处:网络
I have a git setup with a shared repository. As I\'m working on 2 PC\'s I push my personal branches. I\'m rebasing frequently with the develop branch so I need to force a push (git push -f orig开发者

I have a git setup with a shared repository. As I'm working on 2 PC's I push my personal branches.

I'm rebasing frequently with the develop branch so I need to force a push (git push -f orig开发者_如何转开发in feature). But when I want to pull a feature branch whith the forced changes I always get merge conflicts.

Is it possible to force a pull and overwrite the local files?


If you're wanting to just get to the state that you were at on the other machine when you force pushed, just reset --hard to the head that you want:

$ git fetch
$ git reset --hard origin/<yourbranch>
0

精彩评论

暂无评论...
验证码 换一张
取 消