The usual best practice is to rebase your local commits on top of the updated remote tracking branch
git checkout abranch
git fetch
git rebase origin/abranch
That is the equivalent of cherry-picking your commits, except the rebase will do that for you.
But in this instance, instead of cherry-picking or rebasing, it might be easier to do a git merge --squash --no-ff origin/aBranch
.
As mentioned in "Differences between git merge --squash
and --no-commit
", it's almost like you did a cherry-pick on all the merged changes.
That is preferable to a rebase which would attempts to replay your commits on top of a project working tree whose structure has considerable changed.
You will still have conflict to solve, but only in one step.