search

Home  >  Q&A  >  body text

Ignore specified files when git merges

Assume there are master branch and dev branch,
The file structure is as follows:
master
|--fileA
|--fileB

dev
|--fileA
|--fileB

Now I just want to merge the fileA file under dev into the fileA file under master,
However, I don’t want to merge the fileB file under dev into the fileB file under master,

That is, when merging, ignore the fileB files under the two branches;
What should I do?
Thank you.

ringa_leeringa_lee2825 days ago669

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:41:09

    Use .gitignore

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:41:09

    First switch to the master branch: git checkout master
    然后把dev分支下的fileA“移”到本地:git checkout dev -- fileA
    然后add,commit,push:git add fileA, git commit -m "xxx", git push [repo] master

    reply
    0
  • Cancelreply