搜尋

首頁  >  問答  >  主體

版本控制 - git merge的時候總是會有一條commit message,請問這是操作不當嗎?

分支情況:

  dev
  location
* master
  new

操作的時候使用指令:

git merge location

然後會出現commit message的註解

請問各位是什麼地方出錯了?

phpcn_u1582phpcn_u15822845 天前938

全部回覆(1)我來回復

  • phpcn_u1582

    phpcn_u15822017-04-25 09:05:34

    沒有錯…
    如果你使用git help merge,就会看到git merge的文檔。
    然後它提到:

    Then "git merge topic" will replay the changes made on the topic branch since it perged from master (i.e., E) until its current commit (C) on top of master,and record the resultil its current commit (C) on top of master,and record the result in a new name along of the two parent commits and a log message from the user describing the changes.

    merge前

                      A---B---C topic
                    /
               D---E---F---G master
    

    merge後

                     A---B---C topic
                    /         \
               D---E---F---G---H master
    

    所以說,那個commit message是自動加入的。

    如果你實在討厭這個commit,可以在merge時加上--no-commit。這樣就不會產生commit message了。不過我不推薦這麼做,這樣的話,就不容易分辨merge的結果了。

    回覆
    0
  • 取消回覆