search

Home  >  Q&A  >  body text

Problem with deleting files after git merging branches.

Now I have two branches master and dev. There are ten files on the master and nine files on the dev. These eight files are the same as the files on the master.
Now I modify the contents of 8 files on dev, and then switch to the master branch to merge the contents of dev. After that, the two files on my master branch also disappeared, and master completely became the dev branch. . But I still want those two files. How should this problem be dealt with?
Thanks for the help%%

天蓬老师天蓬老师2790 days ago1207

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-02 09:54:50

    The reason may be that you have deleted those files in dev

    The concept of merge is "merging changes from other branches into this branch". Deleting in other branches is also a change that needs to be merged

    You can recover those files after merging:

    $ git checkout (含有想恢复的文件的commit) -- (想恢复的文件1的路径) (想恢复的文件2的路径)
    $ git commit
    

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:54:50

    Thank you! ! !

    reply
    0
  • Cancelreply