我如何使用rebase而不是合并来提取所有远程更改? [英] How can I pull all remote changes with rebase instead of merge?

查看:368
本文介绍了我如何使用rebase而不是合并来提取所有远程更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用 git pull 来进行更改,但它会合并我的本地提交。是否存在 git rebase 等价物,我可以在其中进行远程更改?

解决方案

是的,您可以将 git pull --rebase



您也可以将其设置为默认拉使用 git config branch.autosetuprebase始终跟踪分支时的行为。如果您希望将其设置为您正在跟踪的那些特定类型的分行,请将always替换为remote或local。

现在您只需要do是 git pull



如果由于某种原因想要进行合并,您可以执行<$ c

git pull --no-rebase 。



p> UPDATE:请参阅下面的注释,了解如何在现有分支上执行此操作。


I can pull changes using git pull, but it merges my local commits. Is there a git rebase equivalent with which I can pull in remote changes?

解决方案

Yes you can git pull --rebase.

You can also set that to be the default pull behaviour when you track a branch with git config branch.autosetuprebase always. Replace "always" with "remote" or "local" if you want to do it to those specific types of branches that you're tracking.

Now all you have to do is git pull.

If for some reason you want to do a merge, you can do git pull --no-rebase.

Hope this helps.

UPDATE: see comments below for how to do this on existing branches.

这篇关于我如何使用rebase而不是合并来提取所有远程更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆