search

Home  >  Q&A  >  body text

What is the result when merging a branch with deleted files on git?

Operation

1. For example, there are two branches: dev and myBranch. The content on the two branches is now the same and has been synchronized.

2. Now several files a.txt, b.txt have been deleted on dev; switch to dev locally for pull

3. Then switch to the myBranch branch and merge the dev content into myBranch

Question:

1. Are the files on myBranch deleted after the merge?

2. If the myBranch branch is merged into dev, will it be retained?

Since the company’s git cannot be operated casually, I hope someone who knows can help answer it

仅有的幸福仅有的幸福2820 days ago714

reply all(2)I'll reply

  • 黄舟

    黄舟2017-05-02 09:48:18

    1. git checkout myBranch; git merge dev. The result is that the file is deleted in myBranch.

    2. git checkout dev; git merge myBranch. Because the file has been deleted in dev, merging myBranch will not restore the file.

    3. You can’t play casually with the company’s git, so register a github yourself and play casually.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:48:18

    The files after the merge will be saved. You always have a branch with a.txt and b.txt, so they will not be deleted

    reply
    0
  • Cancelreply