是否可以使用 Visual Studio git 工具执行 Git Pull --rebase(并且可以默认设置)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29399769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to do a Git Pull --rebase with Visual Studio git tools (and can it be set by default)
提问by LocalPCGuy
First, as the title says, is it even possible in a single step (i.e. not fetch
then rebase
), to do a pull --rebase
?
首先,正如标题所说,甚至有可能在一个步骤中(即不是fetch
then rebase
),做一个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)
.
其次,是 Visual Studio 中的一项设置,用于强制内置的 Team Explorer git 工具始终执行一个pull --rebase
而不是标准的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.
我知道您可以使用 设置全局或项目配置文件中的默认值git config branch.autosetuprebase always
,但我想特别了解 Visual Studio 是否可以更新/更改该设置或具有类似的选项,就像大多数其他 GUI 一样。我一直无法找到任何东西,所以它似乎没有,因此问题。
采纳答案by jessehouwing
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 2015 不支持 pull+rebase。您可以通过执行 'branch' 的提取来手动实现它,然后在 'origin/branch' 上进行 rebase。但不是自动的。
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.
如果 Visual Studio 2017(候选版本)在全局 git 设置中配置为默认选项,则当前将执行 pull+rebase。它目前仍然给你一个警告,说“意外的合并结果”。我希望这将在最终版本出来之前修复。
回答by Woonder
In VS2017 you can use built-in feature to change git settings for rebase: go to Team Explorer-> Home-> Settings-> Global Settingsor Repository Settings-> set Rebase local branch when pulling: True(screenshot)
在 VS2017 中,您可以使用内置功能更改 rebase 的 git 设置:转到团队资源管理器->主页->设置->全局设置或存储库设置->拉取时设置Rebase 本地分支:True(截图)
回答by gabeio
This is as close as you can get to doing an actual rebase pull
.
这尽可能接近于做一个实际的rebase pull
.
First do a fetch on the remote you want to rebase onto. It won't be a "pull --rebase" but you can go to team explorer > branches > remotes > (choose your remote) > right click on the branch you want to rebase onto
and click rebase onto
click rebase and you have basically done a pull/rebase onto the remote branch.
首先在你想要变基的遥控器上做一个 fetch 。它不会是“pull --rebase”,但您可以转到团队资源管理器> 分支> 远程>(选择您的远程)> 右键单击您想要的分支rebase onto
并单击rebase onto
单击rebase,您基本上已经完成了拉/变基到远程分支。
(but currently this is the only way to rebase onto remote updates without running to a git bash)
(但目前这是在不运行 git bash 的情况下重新基于远程更新的唯一方法)
回答by GaloisGirl
Open Git Bash and paste:
打开 Git Bash 并粘贴:
git config --global branch.autosetuprebase always
This will make every future pull
a pull --rebase
.
这将使每个未来pull
成为pull --rebase
.