2014-02-17 34 views
0

我有以下分支:這是什麼git日誌 - 圖表指示?

  • upgadingToJquery1.4

  • handlingExceptions

我工作的upgradingToJquery1.4分支和有做了幾個提交。 我創建了另一個分支handlingExceptions作了一些更改並提交它們。 然後我切換回主併合並了handlingExceptions分支。令人驚訝的是我認爲upgardeToJquery1.4分支的變化也得到了合併。然後確認我合併了upgradToJqueyry1.4分支,它表示最新。

有人可以解釋圖表顯示的是什麼嗎?

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 accountControlle catches the exceptions and now prov 
    | |/ 
    | * 76145d1 1. css/images - Jquerymobile icon files 
    | * 34bc7b9 custom-jqueryMobile.js - to override jquerymobile defaults.Currently added transitions dont work with p 
+0

這篇文章可能會幫助你http://stackoverflow.com/questions/20200226/how-to-understand-git-log-graph – user376507

回答

1

結構上,你有這樣的(所有我在這裏做的是重新繪製水平圖表):

  D <-- upgradeToJquery1.4 
     / \ 
- A - B - C \ <-- handlingExceptions 
      \ \ 
------------- E - F <-- HEAD=master 

其中:

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' 

有不同的方式來到這裏,但因爲你創建了handlingExceptions(推測與git checkout -b)最直接的可能是這樣的:

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 

另外,不同的方式來獲得這裏將是:

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 

或代替單獨git checkout HEAD^,你可以git checkout -b handlingExceptions HEAD^創建handlingExceptions,從而犯下了C作爲B其父。

在任何情況下,雖然,在git merge handlingExceptions發生在這點,你就masterhandlingExceptions指出提交C,使創建提交E。提交消息和圖形節點在此相互支持:E的父母是未顯示的東西(第一父母)和C(第二父母)。然後,雖然仍在master上,單獨git merge upgradeToJquery1.4創建承諾F,其父母是E(第一父母)和D(第二父母)。

無論如何,分支標籤現在指向提交D,CF