简体   繁体   English

Egit:将rebase配置为master分支的默认拉策略

[英]Egit: configure rebase as default pull strategy for master branch

In our new project we've got 10 repositories, each of which have interdependent Eclipse projects. 在我们的新项目中,我们有10个存储库,每个存储库都有相互依赖的Eclipse项目。

I plan to establish a default workflow, where each developer is working on the master branch and uses the commit-pull-push cycle. 我计划建立一个默认工作流,每个开发人员都在使用master分支并使用commit-pull-push循环。 To reduce commits and get a nice linear history I prefer rebase as standard strategy for pull. 为了减少提交并获得良好的线性历史,我更喜欢rebase作为pull的标准策略。 This works fine, if branch.master.rebase=true is set. 如果设置了branch.master.rebase=true ,这样可以正常工作。

Unfortunatelly it has to be set manually for all repositories, after they are cloned with EGit. 不幸的是,在用EGit克隆之后,必须手动为所有存储库设置它。 I tried setting branch.autosetuprebase=always , but this affects manually created local branches only, not the master branch after a clone. 我尝试设置branch.autosetuprebase=always ,但这只会影响手动创建的本地分支,而不会影响克隆后的主分支。

I would like to automatize the initial setting of branch.master.rebase=true to reduce errors and for convenience. 我想自动化branch.master.rebase=true的初始设置,以减少错误和方便。 Is there a way to do it? 有办法吗? Preferably inside of Eclipse/Egit, but other ideas are welcome, too. 最好在Eclipse / Egit内部,但也欢迎其他想法。

As mentioned by Ozan's response to their original question, the correct solution is to add 正如Ozan对其原始问题的回答所提到的,正确的解决方案是添加

[branch]
    autosetuprebase=always

in .gitconfig .gitconfig

If you want to make this change in the Eclipse GUI 如果要在Eclipse GUI中进行此更改

  1. Open the Git Perspective in Eclipse. 在Eclipse中打开Git Perspective。
  2. Expand your repository, Branches, Local. 展开您的存储库,分支,本地。
  3. Right-click your branch and click "Configure Branch". 右键单击分支,然后单击“配置分支”。
  4. Check "Rebase". 选中“Rebase”。
  5. Click OK. 单击确定。 Do for the rest of the branches pushed to origin. 将其余的分支推到原点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM