Is there a way to make GitHub Desktop rebase a bra

2020-06-30 04:46发布

问题:

When I choose "update from master", it creates a merge commit. I'd rather just have it re-base. Is this possible?

回答1:

It does not appear that feature is currently included in GitHub desktop. What I normally do is click on the repository name in the drop-down menu in the top left and then click on "open in terminal". Then just follow the instructions here.


Update:

If you add this to your .gitconfig, GitHub desktop should rebase according to here.

[pull]
    rebase = true

Second Update:

GitHub desktop 2.0 now supports rebasing built in! It is under the branch section of the top menu or you can use the shortcut ⇧⌘E



回答2:

Using rebase instead of merging branches results in an easier to follow but less exact history of commits. Your team should agree under what circumstances you should rebase a branch. You should still always merge branches into the main branch through a pull request.

A suggested approach is to allow rebasing local changes that you have made but haven't shared with others, but to merge once you are sharing changes with others. This avoids trouble with rewriting history while still letting you easily catch up with changes as you develop your code locally.

Ref & Source:

  • https://docs.microsoft.com/en-us/vsts/git/tutorial/rebase?tabs=visual-studio#when-to-rebase-vs-merge
  • https://docs.microsoft.com/en-us/vsts/git/tutorial/pulling?tabs=visual-studio#update-your-branch-with-the-latest-changes-from-master


回答3:

No. There was a feature request on their GitHub issue tracker for exactly this option a year ago, for which the response was

This idea is interesting for the future, but this is beyond the scope of our current roadmap.

Since then, another feature request, which is still open, has also been posted.