git pull accept theirs/ours



  • Is there any way to force git during pull-a to use theirs merger strategy for a particular directory? But if conflicts arise elsewhere, let me decide.

    The only thing that comes to mind now is: You make a hook that works after pull-a and starts git checkout --theirs {моя директория}



  • Based on response: https://stackoverflow.com/a/17227804/4827341


    For partial automation, for example, pseudonyms may be used:

    $ git config --global alias.accept-ours = "!f() { [ -z \"$@\" ] && set - '.'; git checkout --ours -- \"$@\"; git add -u -- \"$@\"; }; f"
    $ git config --global alias.accept-theirs = "!f() { [ -z \"$@\" ] && set - '.'; git checkout --theirs -- \"$@\"; git add -u -- \"$@\"; }; f"
    

    conflict after conflict git pull for files/calories to be oursto fulfil:

    $ git accept-ours -- файлы/каталоги ...
    

    a for those to be theirs:

    $ git accept-theirs -- файлы/каталоги ...
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2