我正在使用 Intellij 从上游
存储库中提取内容,在本地进行更改并推送到我的分支(origin
)。我了解如何通过执行获取、正确配置的 pull ,然后正确配置的推送来完成此操作。
我担心的是这里有多个手动步骤。有没有办法将 Intellij 的“更新项目”操作配置为具有不同的默认存储库来更新(获取和 pull )并推送到?目前“更新项目”操作仅从当前存储库更新,很容易忘记从上游
更新。
最佳答案
Is there a way to configure Intellij's 'Update Project' operation to have different default repositories to update from (fetch & pull) and push to?
编号:IDEA-100429是关于考虑 push.default
值,但仍未解决:
2020 calling. This remains very annoying for triangular workflow (separate
@{push}
and@{upstream}
) where I can use IntelliJ to multi-branch, multi-commit across projects but need to go into each one and do a "git push
" which (with no further config) knows what to do where IntelliJ mistakenly tries to push to@{upstream}
instead of honoring thegit config
.
和IDEA-98693提到 Git Push 对话框不记得远程分支,但是:
Remembering the previous branch you pushed to is bad because among other:
Any branch you push to will be remembered and you accidentally could bush to a wrong branch next time, if e.g. you need to push a branch somewhere only once and then push to the upstream/tracked branch again.
The better approach is to set defaults. It is tracked branch by default, but if it does not work - configure git accordingly.
Remembering branch is useful sometimes, but is not in other cases - there are requests to allow setting default branch to push.
git push
behaves differently.So we reverted the behavior! 2018.1 and further will not remember the last branch but will behave like git push on the commSo and line.
So by default, it will select a branch depending on yourgit config
settings.So if you want to push to some specific branches (different from default upstream) specify e.g
git config remote.<name>.push refs/heads/LocalBranch:refs/heads/remoteBranch
有关实际示例,请参阅“Pushing into multiple remote repositories simultanously in IntelliJ”。 (它至少适用于推送到不同的远程存储库)
关于git - 如何在 Intellij 中配置 "update project"以从上游存储库 pull 并推送到分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64397948/