Merging - rsanchez-wsu/jfiles GitHub Wiki
Merging
This page will detail the steps necessary to merge two branches together.
(Sorry about some of the image being hard to read, the Table of Contents on the right shrinks the horizontal space that the page can take up and it compresses some of the wider images)
Checkout the branch you wish to merge into. In this case we will be merging master
into Team12-M1
. Once you are on the right branch, right click the repository and select Merge...
You then will want to select the branch that you want to merge into your current branch for us this is master
. Once selected press Merge
at the bottom.
On the bottom section of your screen select the tab that says Git Staging
. This is where you will be able to see what files need to be dealt with in order to merge successfully. Once on the tab double click one of the files listed under Unstaged Changes
.
This will open up a window above that will show a compare view of the file. On the left is the file's state on your current checked out branch. On the right is the file's state on the branch you are trying to merge into your currently checked out branch.
This view shows the differences between the two versions of the file. This first example is of a line that exists in both files but with a minor change. In this case we want to keep the version on the left so we will press the button with the arrow pointing right. This will copy that change from left to right.
Once you have done that you are good to move on to the next difference in the file using the the button in the top right, as shown below.
You will repeate this process for the rest of the differences in the file. I have pictures of two more examples below. The first one is of a deletion, and the second one is of an addition. In both cases we want to copy the change on the left to the right, however this may not always be the case. (e.g. Someone has pushed a change to the branch you are trying to merge in, however your current branch doesn't have those changes yet.)
Once you have dealt with all the differences in the file you need to save, simply press Ctrl+S
. This will cause Eclipse to update the staging area. Now that there are no differences in the files the file we were working on has been moved to the Staged Changes
section.
Repeat this process until you have dealt with every file under Unstaged Changes
. Once you have done so you are good to enter a commit message and press Commit
.