2013-02-12 35 views
5

我有一個回購主,我FILE1.TXT和FILE2.TXT做我何不讓Git之後提交合並

git checkout -b fix1 

我再改FILE1.TXT

而我呢一個

git commit -a 

然後我做了

git checkout master 

然後我做了

git checkout -b fix2 

我再改FILE2.TXT

,我做了

git commit -a 

然後git checkout master 然後

git merge fix1 
git marge fix2 

,但如果我做了

commit -a 

我得到

 
# On branch master 
nothing to commit (working directory clean) 

回答

8

git merge自動提交。如果你不想犯添加--no-commit說法:

--commit, --no-commit 
     Perform the merge and commit the result. This option can be used to override --no-commit. 

     With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user 
     a chance to inspect and further tweak the merge result before committing. 
3

如果合併成功,沒有發生衝突,git會自動提交它(你應該能夠通過簡單地檢查git log驗證)。

The documentation notes(強調):

...「混帳合併主題」將重播的話題分支上的修改,因爲它從主(即E)分道揚鑣,直到其當前提交(C)在主,的頂部並記錄結果在一個新的提交與兩個父母的名字一起提交,並從用戶描述的變化

如果你想避免這種情況,使用--no-commit日誌消息標誌:

git merge --no-commit fix1 
1

合併後的文件,這些文件沒有衝突已經合併。你可以直接推送你的合併文件。