Reputation: 38583
I have the following situation
git branch
* master
git branch upgrade-project
git checkout upgrade-project
# At this point I run an update script from a third party that replaces
# many files I have already modified.
git checkout master
# I want all conflicts to be marked regardless of weather GIT can merge them automatically.
git merge upgrade-project
The problem there is that it will cleanly merge all files replaced by the update-scripts from the upgrade-project branch as it is ahead of master which makes perfect sense in normal situations.
What I want is that when I merge upgrade-project
into master
all files that are in conflict are marked as such.
This was I can manually compare and make my modifications as needed.
Is this possible?
Upvotes: 1
Views: 66
Reputation: 141986
upgrade-project
branch is ahead ofmaster
.
Mergingupgrade-project
back intomaster
would merge cleanly (no conflicts).
I would like to force conflicts for all files that are not exactly the same
You can get a list of the files which are going to be pulled out before you execute the pull:
git checkout master
git diff --name-only upgrade-project
or:
git log --stat master ^upgrade-project
or
git format-patch master...upgrade-project
The last code sample will create a patch of each commit you have (diffrence between the branches which are going to be merged).
Upvotes: 0
Reputation: 3568
Merge your branch, but do not commit the changes:
git merge --no-commit upgrade-project
Clean the index, leaving the changes in working directory:
git reset
Resolve any conflict marked with <<<<<
if any.
Interactivelly add the "good" changes you need to the index and commit them:
git add -p
git commit
Clean your working directory from unnecessary changes:
git reset --hard
Upvotes: 1