Here is the project log. As the developer can see, the head and origin/master moves forward to the latest commit. however, origin/Feature1 stayed still.
Here is the current history log. Now, everything synced to the latest commit.
check git log from both master and Feature1 branch
--> master branch
--> Feature1 branch
Conclusion:
If there are both commits in the two branches the developers would like to merge, it will be a three-way merging and an extra merge commit will be created.
Cloned the repo, work on two branches
Scenario abstraction
Feature1 branch
andmaster branch
of the repo) (Feature1 branch
was derived frommaster branch
):master
branchFeature1
branchmaster
branch, editedtest8-1
file, add, commit;Feature1
branch, editedtest8-2
file, add, commit;master
branch, mergeFeature1
branch;push
all changes back to remote repo)Results:
Data could be explored:
Detailed steps
step0: start point of the test case:
test8-1
andtest8-2
on both branches --master
andFeature1
branchgit checkout master
touch test8-1
test8
touch test8-2
test8-2
git add
,git commit
,git push origin master
-- bothtest8-1
andtest8-2
git checkout Feature1
git merge master
git push origin Feature1
(sync the two branches, both local and remote-tracking ones) Preparation done.
The edit is: --> test8-1
--> test8-2
When the preparation is done, the history is like:
Step1: cloned the repo ( already did in testcase #1 )
To make it short, we call them:
Step2:
master
branch: edited filetest8-1
, committedchecking out
master
branchonly edit the file
test8-1
(onmaster
branch)git add, git commit, no push yet (on
master
branch)The project history in EGit becomes like (
master
's head moved forward, 1 commit aheadFeature1
branch ):Step3:
Feature1
branch: editedtest8-2
file, add, commit;Only edit
test8-2
git add, git commit, no push yet (on
Feature1
branch)Then the log history becomes:
Step4: checking out
master
branch, mergeFeature1
branch backmaster
branch withFeature1
branchAs the developer can see,
master
head
moved 1 commit forward, which is amerge commit
Step5: move
Feature1
branch forward --> mergeFeature1
branchFeature1
branch withmaster
branchthen the history becomes:
Feature1
head
move 1 commit forward, the same asmaster
branchStep6: push all changes back to remote repo
master
commits toorigin/master
Here is the project log. As the developer can see, the
head
andorigin/master
moves forward to the latest commit. however,origin/Feature1
stayed still.Feature1
commit toorigin/Feature1
branchHere is the current history log. Now, everything synced to the latest commit.
git log
from bothmaster
andFeature1
branch-->
master
branch-->
Feature1
branchConclusion: