Merging a dev branch shows lots of very old commits #22787
-
Hi, I’m trying to merge the “dev” branch to “master” branch but when creating a pull request, it contains many, many old commits. I used to follow the steps outlined in http://git.tutorialhorizon.com/2014/10/05/replace-the-master-branch-with-another-branch-in-git/ but I wonder if there’s a better way to fix this mess once and for all. Ideally, I just need to create a pull request to base master and compare dev branch on GitHub. Plain and simple. It should technically show the commits since the last time I did the merge, shouldn’t it? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
yitam:
As long as there haven’t been any rebases or similar actions, yes. For example, if your last merge was a rebase merge it has recreated the merged commits, so they technically aren’t the same, and will be merged again unless you modify your dev branch to be based on the rebased commits. Similar for squashed commits, or any rebases outside Github. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. I think my question really is “how to make my master branch the same as my dev branch” from now on. Now that the two branches are so different, how should I proceed? To simply rename these two branches is the last resort, I suppose. |
Beta Was this translation helpful? Give feedback.
-
Well, it depends on whether you are okay with force-pushing and the associated issues or not. If not, you’ll have to merge and resolve any conflicts in favor of the If you are okay with force-pushing and losing everything that’s different from
So, you can do something like this:
Obligatory warning: If you do this, you will lose anything that’s only on the current |
Beta Was this translation helpful? Give feedback.
Well, it depends on whether you are okay with force-pushing and the associated issues or not. If not, you’ll have to merge and resolve any conflicts in favor of the
dev
branch.If you are okay with force-pushing and losing everything that’s different from
dev
on themaster
branch, you can usegit reset [<mode>] [<commit>]
:So, you can do something like this:
Obligatory warning: If you do this, you will lose anything that’s only on the current
master
, and every…