Git does not apply deleted files when merging an old branch into the master. How can I tell Git to apply deleted files?

前端 未结 4 823
小鲜肉
小鲜肉 2021-01-02 03:42

I have a master and a dev branch. I made commits in both. I also deleted some files in dev. I made other commit in master, so this master branch is more recent.

My i

4条回答
  •  旧巷少年郎
    2021-01-02 04:33

    You can run the merge without committing, make sure you have all of the correct files, and then run the commit.

    1. Perform the merge

      git checkout master
      git merge --no-commit dev
      
    2. Make the necessary changes, and fix merge conflicts (if any).

      git rm my-files-to-delete
      
    3. Commit the merge, finishing the process.

      git commit
      

提交回复
热议问题