-
Notifications
You must be signed in to change notification settings - Fork 2
Enabling Pull with Rebase for GitHub Desktop
By default the GitHub Desktop causes the pulls to merge if you have made commit without pulling the latest changes first. This also happens if someone pushes their changes at the same time you are trying to push yours, forcing you to fetch and pull the new changes.
These merges can get pretty messy, especially if there are conflict between the changes you and someone else have made.
One way a circumvent this issue is to rebase the incoming changes from the remote into your local repo, however this function isn't available by default on GitHub Desktop.
To enable pull with rebase you will need to tell your .gitconfig file to use rebase specifically.
- Your global .gitconfig file is found at C:\\Users\{
Account_name
}\.gitconfig - Add: [pull] rebase=true to the end of the file.
- Save the config file. Now you should see pull origin replaced with pull origin with rebase.
The main caveat of enabling this, is that you will need to stash any changes you haven't committed yet each time you want to pull changes from the remote. Additionally any conflict would now need to be solved manually, but most IDE (like Visual Studio) offer easy tools to solve these conflicts. And you are in a less of a risk that the automatic merge messed something up.
TL;DR
Most other version control system do this automatically and you don't need to think about this at all.
Short explanation here: Merging vs. rebasing.
Example:
C:\Users\petays>type .gitconfig
[user]
name = Jari Petays
email = [email protected]
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[pull]
rebase = true
[difftool "sourcetree"]
cmd = "'' "
[mergetool "sourcetree"]
cmd = "'' "
trustExitCode = true