簡體   English   中英

簽入和分析分支中的文件而無需移動到主分支

[英]Checking in and out files within branches without moving to the Master Branch

假設我有4個分支

Master Branch

Branch 1

Branch 2

Branch 3

我目前在分支3,我想從分支2到分支3獲取所有文件,而不將文件提交到主分支。
那可能嗎?

你可以:

  • 將branch2合並到branch3

      git checkout branch3 git merge branch2 
  • 或者,根據您的需要,強制branch3成為branch2

     git checkout branch2 git branch -f branch3 branch2 git checkout branch3 

(那將用branch2替換branch3的歷史)

在這兩種情況下,master上的提交都將保持不變。

  • 選項1 - 將branch2合並到branch3中

它將記錄您的branch3中的合並歷史記錄。

`git checkout <branch 3>
 git merge <branch 2>`
  • 選項2 - 將您想要的文件提取到branch3中

    git checkout <branch 3> git checkout <branch> -- path/to/files

暫無
暫無

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

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