We\'re using posh-git on Windows Powershell for source control.
We\'re in the unenviable position of storing some of our built assemblies in our git repo. I know al
You can do git merge develop -X theirs
, and all conflicts will take the remote branch's copies.
Edit: Looking back over your question I see that you only want to take "theirs" for a particular subfolder. In that case, after git merge develop
, do git checkout --theirs /Source/Foundation Assemblies/
. This will replace the contents of that folder with "theirs". Then just git add /Source/Foundation Assemblies/
and you are good to go.
You have several merge strategies which you can use:
This can only resolve two heads (i.e. the current branch and another branch you pulled from) using a 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is considered generally safe and fast.
This can only resolve two heads using a 3-way merge algorithm. When there is more than one common ancestor that can be used for 3-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3-way merge. This has been reported to result in fewer merge conflicts without causing mismerges by tests done on actual merge commits taken from Linux 2.6 kernel development history. Additionally this can detect and handle merges involving renames. This is the default merge strategy when pulling or merging one branch.
The 'recursive' strategy can take the following options:
This option forces conflicting hunks to be auto-resolved cleanly by favoring 'our' version. Changes from the other tree that do not conflict with our side are reflected to the merge result. For a binary file, the entire contents are taken from our side.
This should not be confused with the 'ours' merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree did, declaring 'our' history contains all that happened in it.
This is the opposite of 'ours'.
and even more but those are the main ones.
The "right" way in your case is to rebuild the assemblies before committing the merge. I don't see why you would not do this. The steps as follows should work:
git add
all conflicted sources. Then whatever happens during merge should not affect what you commit.git add
the ready assemblies.EDIT: try this:
git rm --force -r <dirname>
kdiff3
did not)git add <dirname>
I tried this bash script to reproduce you case as I understand it.