Is there a way to make GitHub Desktop rebase a branch against master?

徘徊边缘 提交于 2019-12-05 08:56:02

问题


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.



来源:https://stackoverflow.com/questions/37492908/is-there-a-way-to-make-github-desktop-rebase-a-branch-against-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!