How do I pull (with reset) a PR branch? #3617
-
I like to check out a PR branch and review locally. Sometimes when I pull, I get this error, because the author of the PR force-pushed:
I can drop to the terminal and run something like Is there a way for me to somehow reset to the latest commit on the remote PR branch via lazygit? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
While doing a hard reset onto your upstream works, it's not the recommended way to resolve this. The downside is that if you ever have the situation where the upstream was force-pushed, but you also have local commits that you didn't push yet (not at all an uncommon situation for me), the hard reset will blow away your local commits. It's much better to rebase onto your upstream instead. You can do this manually by selecting your local branch and hitting However, I recommend to do (Side note: |
Beta Was this translation helpful? Give feedback.
While doing a hard reset onto your upstream works, it's not the recommended way to resolve this. The downside is that if you ever have the situation where the upstream was force-pushed, but you also have local commits that you didn't push yet (not at all an uncommon situation for me), the hard reset will blow away your local commits.
It's much better to rebase onto your upstream instead. You can do this manually by selecting your local branch and hitting
u r
.However, I recommend to do
git config --global pull.rebase true
once, then every "git pull" will automatically do the rebase for you, and you never have to deal with this problem again.(Side note:
"origin/$(git rev-parse --abbrev-re…