简体   繁体   中英

git merge branch, ignoring some commits

I would like to merge branch A into branch B, however branch A has a few commits that delete files, which branch B needs. Using git merge A while on branch B only deletes the files. How can I merge branch A into B properly?

If you do want to have a merge commit in your history (eg to keep track of how information is moved around in your project), you can also use git merge --no-ff --no-commit A . This command will pause the merge process just before the commit is created, giving you a chance to check the code or apply some extra modifications to this commit.

You can then restore the deleted files using git reset -- <file> and git checkout -- <file> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM