Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does merge xx onto xxx mean

In my repo, I have one branch (branch_1) and from it I have been committing some changes. Then I created a new branch from branch_1, branch_2.

Master---
         \
          Branch_1--commit1--commit2
                                   \
                                    Branch_2 (current branch) 

Meanwhile, a review was done in Branch_1 and I did some changes:

  Master---
             \
             Branch1--squashed commit1,commit2--commit3--commit4
                                       \
                                        Branch2 (current branch)

How can I now apply the last changes of branch_1 in branch_2?
What it means to merge branch_1 onto branch_2 and vice versa.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It seems like that in your case, branch_1‘s changes have been already made public and available on the remote repository, while branch_2 changes are local to your repository. In this situation, it would be best to fetch or pull branch_1‘s new changes and rebase branch_2 on top of branch_1.

# integrating new changes into branch_1
git checkout branch_1
git pull

# integrating branch_1' changes into branch_2
git checkout branch_1
git rebase branch_1

This operation will basically re-write on top of branch_1 each commit made on branch_2 after the divergence. Like so, the new changes in branch_1 will be present in branch_2, with a more linear history than merging the two branches back and forth (this is assuming that branch_2 will be merged into branch_1 or a master branch at some point).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading