git merge: Removing files I want to keep!

前端 未结 5 1360
别跟我提以往
别跟我提以往 2020-11-28 05:08

How can you merge two branches in git, retaining necessary files from a branch?

When merging two branches, if a file was deleted in one branch and not in an

5条回答
  •  失恋的感觉
    2020-11-28 05:54

    For a quick fix in this case, "git revert" the commit that deleted the file.

    When this situation comes up in the future, the better way to handle it is to ensure that the creation of the new file happens on the branch. Then it gets added on master when you merge, but you don't have the file lying around in master in the meantime.

提交回复
热议问题