There is a master branch and a feature branch. The feature branch contains some new files that are not in master , as well as a modified version of the main.cpp file. All changes were made by one developer. With the usual merge the feature branch in the master branch, without conflict, I get everything from the master + new files from the feature + main.cpp file from the feature . The main.cpp file from master is lost.

I tried to rename the main.cpp file to main_master.cpp before merging in the master branch, but even then I end up with the renamed main_master.cpp file with the content from the feature branch.

How to make so that in the end both files are saved?

  • copy main.cpp somewhere, merge into a master, add a new version of main.cpp, make a commit - Sergey Konovalov
  • @ SergeyKonovalov Can I explicitly describe my behavior using git ? - iota
  • git-scm.com/book/ru/v1/...this is the thing. git stash - Sergey Konovalov
  • 2
    "The main.cpp file from master is lost" - why is it lost, how do you understand it? - 0xdb

0