How can I simply (e.g. in one command?) merge in Git, keeping the state of conflicting files as in the current branch and without specifying each file individually as in theirs/ours options?
git checkout master
git merge stable --some-option-to-keep-files-?
In order to avoid a merge conflict, all changes must be on different lines, or in different files, which makes the merge simple for computers to resolve. In other words, if a change introduces any ambiguity even at a single line of code an automatic merging is canceled and the whole process must be finished manually.
Merging a specific commit from one branch to another is pretty easy: use the git cherry-pick command. The syntax is: git cherry-pick <commit hash> . Here is how you go about doing it. First make a note of the commit hash using the git reflog or git log command.
The merge strategy has an "ours" option which is what you want
git merge -s recursive -X ours remote/branch
As the manpage stresses out, this is NOT git merge -s ours.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With