Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I merge the entirety of one branch into another, not just pick one commit?

therealjimrichards
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 27, 2024

I've branched to work on a feature. Let's call it feature-branch. Now I want to merge ALL of the changes on that branch, and I mean - the whole shebang - into my master branch?

So, I start by checking out the master branch and then choose "Merge" but I am invited to pick one commit from feature-branch. I can't select ALL the commits.

If I choose the most recent commit from feature-branch, will that merge it AND all the committed changes that occured before it? I guess not, cos the most recent commit only has certain changes and anything before it is recorded in a separate, previous commit.

How do I merge ALL the changes from feature-branch into master?

Thanks!

 

1 answer

0 votes
Robert Wen_Cprime_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2024

Hi @therealjimrichards !

I'm not following your third paragraph.  The way Git works is that changes are cumulative.  The next commit should be made up of all of the changes from previous commits and whatever new things you have added and staged.  Thus, when merging from your feature branch to master, it'll use the most recent commit.

Can you show a series of diff output that shows that's not the case?

therealjimrichards
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 29, 2024

Hi @Robert Wen_Cprime_ thanks for your reply. I think my answer is encapsulated in your phrase: "changes are cumulative", thus if I choose the most recent commit, that'll have the effect of bringing all the previous commits with it if I merge from that point.

I find it a bit confusing because I was under the impression that commits were separate "steps" in the history of the repo since it's possible to revert an individual commit without that revert necessarily having a knock-on effect on any commits that follow.

In other words, when you revert a commit you don't "rewind" to that point - you instead just reverse the changes detailed in that commit, which is useful but is counter-intuitive to the idea that changes are cumulative.

Robert Wen_Cprime_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 29, 2024

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events