Reputation: 5632
I have the following branches:
master
upgadingToJquery1.4
handlingExceptions
I was working on the upgradingToJquery1.4 branch and had made a few commits.
I created another branch handlingExceptions made some changes and committed them.
Then I switched back to master and merged the handlingExceptions branch. Surprisingly I think the changes in upgradeToJquery1.4 branch also got merged. Then to confirm I merged the upgradeToJquery1.4 branch and it said up to date.
Can someone just explain what the graph is indicating here?
git log --oneline --decorate --graph --all
* a54bd6d (HEAD, master) Merge branch 'upgradeToJquery1.4'
|\
| * d4f762c (upgradeToJquery1.4) main.sass updated
* | bcf7a4f Merge branch 'handlingExceptions'
|\ \
| * | 471c1ad (handlingExceptions) the postLogin method in the accountController catches the exceptions and now prov
| |/
| * 76145d1 1. css/images - Jquerymobile icon files
| * 34bc7b9 custom-jqueryMobile.js - to override jquerymobile defaults. Currently added transitions doesn't work with p
Upvotes: 0
Views: 117
Reputation: 487993
Structurally, you have this (all I have done here is redraw the graph horizontally):
D <-- upgradeToJquery1.4
/ \
- A - B - C \ <-- handlingExceptions
\ \
------------- E - F <-- HEAD=master
where:
A = 34bc7b9 custom-jqueryMobile.js - to ...
B = 76145d1 1. css/images - Jquerymobile icon files
C = 471c1ad the postLogin method in ...
D = d4f762c main.sass updated
E = bcf7a4f Merge branch 'handlingExceptions'
F = a54bd6d Merge branch 'upgradeToJquery1.4'
There are different ways to get here, but given that you created handlingExceptions
(presumably with git checkout -b
) the most straightforward would probably be this:
git checkout upgradeToJquery1.4
... make commit A (or maybe it was already there but you said make "a few" commits)
... make commit B
git checkout -b handlingExceptions
... make commit C
git checkout upgradeToJquery1.4
... make commit D
git checkout master
git merge handlingExceptions
git merge upgradeToJquery1.4
Another, different way to get here would be:
git checkout upgradeToJquery1.4
... make commits A, B, and D
git checkout HEAD^ # get back onto commit B
git checkout -b handlingExceptions
... make commit C
... now checkout master and merge as before
Or instead of a separate git checkout HEAD^
, you could git checkout -b handlingExceptions HEAD^
to create handlingExceptions
such that commit C
got B
as its parent.
In any case, though, at the point at which git merge handlingExceptions
occurred, you were on master
and handlingExceptions
pointed to commit C
, so that created commit E
. The commit message and graph nodes support each other in this: E
's parents are something-not-shown (first parent) and C
(2nd parent). Then, while still on master
, a separate git merge upgradeToJquery1.4
created commit F
, whose parents are E
(first-parent) and D
(2nd parent).
In any case, the branch labels point to commits D
, C
, and F
now.
Upvotes: 1