簡體   English   中英

Git 將文件從現有分支刪除到另一個現有分支

[英]Git remove a file from existing branch to another existing branch

我想從現有分支中刪除一個文件並將其添加到另一個現有分支中。 例如,我有兩個分支 a 和 b。 我在分支 a 中,我想從分支 a 中刪除文件 a.php 並添加到現有分支 b 中的該文件中。

首先將 a.php 添加到分支 B:

結帳分行 B:

git checkout branchB

從 branchA 簽出文件

git checkout branchA a.php

然后提交這個文件

git commit

然后從 branchA 中刪除 a.php

結帳分行 A:

git checkout branchA

刪除文件

git rm a.php

並提交刪除

git commit

暫無
暫無

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

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