如何让Git默认使用所有存储库的rebase? [英] How to make Git pull use rebase by default for all my repositories?
问题描述
有没有办法设置主机Git存储库,以便从其本地克隆完成的 git pull
使用 - rebase code>默认?通过在StackOverflow上搜索,我了解到了
branch.autosetuprebase
,但它需要单独为每个克隆配置。
我的项目流设置为使得我们 pull
develop
merge 将一个功能分支添加到它。这 pull
几乎总是使用 --rebase
,所以我想弄清楚这是否可以成为默认值。
(编辑)根据以下讨论重新构建问题,并使用 从最细粒度到最一般,它们是: 设置为 设置为 设置为 因此,虽然您不能更改默认对未来所有存储库克隆的行为,可以通过 Is there a way to setup the host Git repository such that any My project flow is set up such that we (Edit Restructured the question according to discussion below with Jonas Wielicki.) There are now 3 different levels of configuration for default pull behaviour. From most fine grained to most general, they are: Setting this to Setting this to Setting this to So while you can't change the default behaviour for all future clones of a repository, you can change the default for all of the current user's (existing and future) repositories via 这篇关于如何让Git默认使用所有存储库的rebase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
1。
分支。< branchname> .rebase
true
意味着除非明确使用 git pull --merge
,否则该特定分支将始终通过重新绑定从其上游拉取。
2。
branch.autosetuprebase
始终
意味着每当创建一个跟踪分支时,就会为其创建一个类似上面的配置条目。对于更细粒度的控制,这也可以设置为从不,
本地
或远程
并且可以在每个存储库或全局设置。请参阅
git config --help
了解更多详情。
3。
pull.rebase
true
表示 git pull
总是等于 git pull --rebase
(除非分支。< branchname> ; .rebase
显式设置为 false
)。这也可以设置每个存储库或全球。
结论
git config --global pull.rebase true
更改所有当前用户(现有和未来)存储库的默认值。 git pull
done from its (local) clones uses --rebase
by default? By searching on StackOverflow, I learned about branch.autosetuprebase
, but it needs to be configured per clone individually. pull
the develop
branch before merge
ing a feature branch to it.This pull
nearly always uses --rebase
, so I am trying to figure out if this can be the default. 1.
branch.<branchname>.rebase
true
means that that particular branch will always pull from its upstream via rebasing, unless git pull --merge
is used explicitly.2.
branch.autosetuprebase
always
means that whenever a tracking branch is created, a configuration entry like the one above will be created for it. For finer grained control, this can also be set to never
, local
or remote
and can be set per repository or globally. See git config --help
for further details.3.
pull.rebase
true
means that git pull
is always equivalent to git pull --rebase
(unless branch.<branchname>.rebase
is explicitly set to false
). This can also be set per repository or globally.Conclusion
git config --global pull.rebase true
.