git 如何在 SourceTree 中正确变基?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25747146/
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
How to properly rebase in SourceTree?
提问by Patrick
SourceTree 1.6.4.0 on Windows 7.
Windows 7 上的 SourceTree 1.6.4.0。
Let's say the following is my starting point:
假设以下是我的起点:
C <- master
/
- A - B <- topic
I want to rebase topiconto master.
My goal is to have:
我要重订话题到主。
我的目标是:
C - A - B
^ ^
master topic
but I end up with:
但我最终得到:
I can then do
然后我可以做
git push origin topic -f
and I get the intended result, but what is the proper way to do this in SourceTree?
我得到了预期的结果,但是在 SourceTree 中执行此操作的正确方法是什么?
采纳答案by filhit
Update: SourceTree 1.9.1
更新:SourceTree 1.9.1
You can enable force push in Tools/Options/Git/Enable Force Push. After it is enabled you can check "Force Push" check box in the "Push" dialog.
您可以在工具/选项/Git/启用强制推送中启用强制推送。启用后,您可以在“推送”对话框中选中“强制推送”复选框。
Original answer
原答案
You have to do a force push, because topic branch is already published and you are rewriting history. Commits A and B from origin/topic are removed if you rebase.
您必须进行强制推送,因为主题分支已经发布并且您正在重写历史。如果您重新设置基准,则来自原点/主题的提交 A 和 B 将被删除。
You should make a merge if you don't want to do a force push, specially if you have a team members already working on topic.
如果您不想进行强制推送,则应该进行合并,特别是如果您的团队成员已经在处理主题。
You can't do a force push with SourceTree for Windows yet (see answers at atlassian forums). You can vote for this feature here: https://jira.atlassian.com/browse/SRCTREEWIN-338
您还不能使用适用于 Windows 的 SourceTree 进行强制推送(请参阅atlassian 论坛上的答案)。您可以在此处投票支持此功能:https: //jira.atlassian.com/browse/SRCTREEWIN-338
回答by jacoballenwood
UPDATE: SourceTree Version 2.6.3 (134) (for Mac)
更新:SourceTree 版本 2.6.3 (134)(适用于 Mac)
Go to SourceTree/Preferences/Advanced
and click the 'Allow force push' checkbox at the top of the 'Advanced' dialog.
转到SourceTree/Preferences/Advanced
并单击“高级”对话框顶部的“允许强制推送”复选框。
This allows for the ability to click Force Push in the push dialog whilst pushing a commit.
这允许在推送提交的同时单击推送对话框中的强制推送。
Previous versionshad this at SourceTree/Preferences/General
toward the bottom of the 'General' dialog.
以前的版本SourceTree/Preferences/General
在“常规”对话框的底部有这个。