I’m the sole man working on my project and I have a dev machine, a nas, and another machine. I work on my dev, push changes on my project to the remote repo on my nas, normally this works well, but now I made some directory changes and pushed them to the master branch on my nas. I again made some directory changes and wanted them again to push on my nas. So first I did a pull git pull origin master and that fails with:
CONFLICT (rename/rename): Rename "svgopen/presentation/images/wine-problem.jpg"->"presentation/svgopen/images/wine-problem.jpg" in branch "HEAD" rename "svgopen/presentation/images/wine-problem.jpg"->"presentation/images/wine-problem.jpg" in "7fee244f7b93b0300783519870f2a8287ef6ace4"
git status shows:
# added by them: images/wine-problem.jpg
# added by them: images/wine-problem2.jpg
# added by us: svgopen/images/wine-problem.jpg
# added by us: svgopen/images/wine-problem2.jpg
Indicating the same images in an images directory which has been moved. Is there a way to convince git quickly that all additions ‘by us’ are the ones to be maintained? And ‘by them’ is rubbish and can be ignored?
If you’re doing a merge then you can use the following options:
git merge -s recursive -X ours. This will automatically accept local changes as the correct ones in any conflict resolution.Or, since you’re the only man on the project you might just do a
git push --forceto force the remote repo to match your local copy.