Is it possible to do a Git Pull --rebase with Visual Studio git tools (and can it be set by default)

14,960

Solution 1

Visual Studio 2015 does not support pull+rebase. You can achieve it manually by performing a fetch of 'branch' and then do a rebase onto 'origin/branch'. But not automatically.

Visual Studio 2017 (release candidate) will currently perform the pull+rebase if it's configured as default option in your global git settings. It does currently still give you an warning saying "unexpected merge result". I'm hoping this will be fixed before the final version comes out.

Solution 2

In VS2017 you can use built-in feature to change git settings for rebase: go to Team Explorer -> Home -> Settings -> Global Settings or Repository Settings -> set Rebase local branch when pulling: True (screenshot)

Share:
14,960
LocalPCGuy
Author by

LocalPCGuy

Developer of websites, tech geek, software engineer, front-end focused (JavaScript/HTML/CSS, Flutter/Dart) with some dabbling on the server side (NodeJS, .Net/C#, PHP, SQL).

Updated on June 03, 2022

Comments

  • LocalPCGuy
    LocalPCGuy almost 2 years

    First, as the title says, is it even possible in a single step (i.e. not fetch then rebase), to do a pull --rebase?

    Second, is a setting in Visual Studio to force the built-in Team Explorer git tools to always do a pull --rebase rather than a standard pull (fetch/merge).

    I am aware you could set the default in the global or project config files with git config branch.autosetuprebase always, but I wanted to specifically find out if Visual Studio could update/change that setting or had a similar option, like most other GUIs have. I haven't been able to find anything, so it seems like it doesn't, hence the question.