How to stop the merge (again ....)

How can I permanently stop Git from trying to merge? I never want it to merge.

From How do I make Git honor a canceled merge that was not asked for? I know the tool doesn't respect my undo by killing the editor it spins without asking me. So now I'm just a kill -9

terminal process.

If I get into a situation where Git wants to merge, I always need a copy of the original file. I'll just delete the file locally and then fetch it from the server again.


Right now Git is doing DoS'ing me with this fraction:

You have not completed your merge (MERGE_HEAD exists).
Please make your changes before you can merge.

Of course it git reset HEAD <file>

didn't work.

And here's the best part: it's tag accurate . There are no differences . I make changes, I test them on 8-12 different platforms (copying from scp

) and then test it on one of these fields after testing. But from Tell Git to stop requesting conflicts when no one exists? I know the tool is too stupid to show any intelligence in this area.


In case you're wondering, there is one set of sources. These are project sources located on a remote server. All I want to do Git is checkout (clone), update (pull), tell me what has changed (diff) and checkin (push). I don't need any other functionality from the tool.

+1


source to share


2 answers


You can declare a custom merge driver for ' *

' (all files) in .gitattributes

, with keepTheir

script.

echo * merge=keepTheir > dirWithCopyMerge\.gitattributes
git config merge.keepTheir.name "always keep theirduring merge"
git config merge.keepTheir.driver "keepTheir.sh %O %A %B"

      

keepTheir.sh

will be:

mv -f $3 $2
exit 0

      




I need to get a copy of the file on the server (and possibly modify it). In Subversion I would use svn update

Simple: use git fetch

(which won't trigger any merge) and then git checkout

:

git checkout origin/master -- path/to/file

      

(see " git: how to update (check) a single file from a remote original source ")

+4


source


Add this to your .git/config

[merge "keepTheir"]
   name = always keep their during merge
   driver = cp -f %B %A 

      



and add this to your .gitattributes

public/dist/app.min.css merge=keepTheir

      

0


source







All Articles