簡體   English   中英

如何將更改與開發分支合並到功能分支

[英]How to merge changes with develop branch down to a feature branch

情況

  1. git branch
    • 開發
    • 功能/一個
    • 功能/兩個
  2. feature/onefeature/two是相同的,是從develop分支出來的,因此develop分支也與功能分支相同。

  3. feature/one已更新,可以說已編輯foo.css

     body { background: #fff; /* new code */ height: 100%; } 
  4. git checkout develop && git merge feature/one

  5. feature/two也進行了更新,並且忘記了在更新之前從foo.css分支進行合並,添加了兩個文件,並且還為foo.css添加了一些CSS。

     body { height: 100%; } .bar { color: #000; } 
  6. 現在,我還沒有上演來自feature/two任何事情,因為我知道我上演並提交它的時間,如果我執行git add --all && git commit -m "some commit message" && git merge develop ,我將有沖突在foo.bar

這是什么情況,我試圖避免文件沖突,因為它感覺不正確,並且當我執行git mergetool ,它會創建其他文件,例如REMOTE,ORIG,LOCAL,並且我很難理解是那些,但是我知道,我應該通過編輯<<<<<======之間的行來決定應保留哪行代碼

我知道這幾乎是一種普遍情況,要素分支不知道事前對develop分支進行了更改,因此它們在編輯之前將無法首先合並,或者合並確實是工作流程的一部分在功能分支上執行任何操作之前先從develop分支開始嗎?

您只是有正常的合並沖突。 試用一些合並工具,然后將Git配置為使用您喜歡的工具。 REMOTE,ORIG,LOCAL是與文件的“其”,“合並基礎”和“您的”版本相對應的臨時文件。 除了最瑣碎的合並,我不建議手動編輯任何合並沖突標記。

然后調整以下git配置設置

trustExitCode-通常為true

keepBackup-假

keepTemporaries-錯誤

提示-錯誤

mergetool.<tool>.trustExitCode
For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge.

mergetool.keepBackup
After performing a merge, the original file with conflict markers can be saved as a file with a .orig extension. If this variable is set to false then this file is not preserved. Defaults to true (i.e. keep the backup files).

mergetool.keepTemporaries
When invoking a custom merge tool, git uses a set of temporary files to pass to the tool. If the tool returns an error and this variable is set to true, then these temporary files will be preserved, otherwise they will be removed after the tool has exited. Defaults to false.

mergetool.prompt
Prompt before each invocation of the merge resolution program.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM