Domanda

On the master branch there is a directory dir1. Some feature branch was outgoing from the master branch and changed some files in dir1.

Meanwhile in the masterbranch the directory dir1 was renamed to dir2. Now I want to merge the feature branch to the master branch. The result should be that both directories should exist in the master branch.

Unfortunately git is unable to do so with simple commands. Since it tracks the content it tries to put the changes from the files in dir1 to dir2. How to tell git to do so?

È stato utile?

Soluzione

I'd try the following before having done the merge:

git merge --no-commit
git checkout feature -- dir1/
git checkout master -- dir2/    
git commit

. With --no-commit you force git to create the commit automatically if there are no conflicts.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top