简体   繁体   中英

git :: merge files from different folders in local and remote branch

I am redesigning the directory structure for the project, so I moved lots of files from one folder to another one in my local branch. In the remote branch guys have been done some refactoring, and some files were moved to another folders. Now when merging with remote I have such conflicts:

added by us: module/src/main/java/com/test/tool/MyClass.java
...
added by them: src/com/test/tool/overlay/MyClass.java

At this point it is not clear for me how to resolve such conflict - should I manually move the file from src/com/test/tool/overlay/MyClass.java into module/src/main/java/com/test/tool/MyClass.java and then use git add , or there is another preferred way, which will record this change?

Something like this is where communication is just as important as the tool. However my short answer is that if someone else has already commited some refactoring and your local copy does not reflect that yet, you would solve the conflict locally before reattempting to merge. A git rebase perhaps to bring those new changes, then update your files accordingly?

It is always recommended to resolve merging conflicts manually. So yes move the files around manually, and then upload the new folder structure by using Git add.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM