Santam
Santam

Reputation: 301

How to pull updates to a branch from master without having them on my commit history?

I made a pull request long back and in the meantime there have been some updates in the master branch. If I simply run git rebase master then all the new commits from master appear in the commit history of this branch. How to update my PR without having the updated commit history from master in this branch?

My PR has 2 commits and the master branch has around 10 new commits. If I run the above mentioned command then my PR gets a total of 12 commits.

Upvotes: -1

Views: 1632

Answers (1)

matt
matt

Reputation: 535202

Get onto your PR branch and merge master into it:

git switch myPRBranch
git fetch origin master:master
git merge master

Resolve any merge conflicts and you're all set.

Doing this is totally normal; in fact, in my organization it is required behavior. If your PR branch lives for longer than few days, it needs to have main merged into it (every few days). Otherwise you can end up with a horror when the time comes to merge the PR branch.

Upvotes: 2

Related Questions