How can I git pull –rebase but taking all remote changes?

I did git fetch and then git pull --rebase. It is trying to merge changes from the remote branch to my local branch. And there are some merge conflicts. So I did a git reset --hard.

My question is it is possible for me to ask git pull to take the remote change whenever there is a conflict?

  • what's wrong with git clone? index-pack died of signal 99 error
  • Jenkins unable to run Maven
  • How to conveniently sync a file between two git repositories
  • git pull generates “fatal: No remote repository specified.” error
  • Git: how to push changes made to only certain files?
  • .gitignore not ignoring .idea path
  • SourceTree: Adding a custom action to open a file in an external editor
  • GIT - '~/repo.git/' is not a git command
  • How to trigger a build only if changes happen on particular set of files
  • What are Insertions & Deletions in Git?
  • Case-insensitive git pickaxe search
  • Resolve “CONFLICT (delete/modify)” in git
  • One Solution collect form web for “How can I git pull –rebase but taking all remote changes?”

    I think what you want is this:

    git pull --rebase -s recursive -X ours
    

    But it doesn’t work (I’m using 1.7.0.4), even though the manpage says it should. I’m guessing this is due to the issue mentioned here.

    Instead, you could use:

    git pull -s recursive -X theirs
    

    It works as expected, but you’ll get a merge instead of a rebase.

    Also – note ‘ours’, rather than ‘theirs’ when using –rebase. From the git-rebase manpage:

    [CLIP]… a rebase merge works by replaying each commit from the working branch on top of the upstream branch. Because of this, when a merge conflict happens, the side reported as ours is the so-far rebased series, starting with upstream, and theirs is the working branch. In other words, the sides are swapped. …[CLIP]

    Git Baby is a git and github fan, let's start git clone.