如何在 Sourcetree 中执行 Git Rebase?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15840561/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:55:26  来源:igfitidea点击:

how do a Git Rebase in Sourcetree?

gitatlassian-sourcetree

提问by shicholas

I want my local master branch to include the commit 'fixed js errors' and be rebased into origin/master.
enter image description here

我希望我的本地 master 分支包含提交“修复 js 错误”并重新定位到 origin/master。
enter image description here

I started the process like this: enter image description here

我开始这个过程是这样的: enter image description here

Which leads me to this: my Sourcetree

这让我想到了这个: my Sourcetree

But as you can see, I'm asked to pull before I push. And every time I pull I end up with a situation depicted in the first image. What am I doing wrong?! Thanks,

但正如你所看到的,我被要求在推动之前先拉。每次我拉我都会遇到第一个图像中描述的情况。我究竟做错了什么?!谢谢,

采纳答案by CodeNaked

Your original structure would not support rebasing. Let's say you had a commit to your local masterand someone else had committed (and pushed) another change to origin/master. In this scenario, you could rebase your commit on top of the other commits.

您的原始结构不支持变基。假设您提交了本地文件,master而其他人已提交(并推送)了另一个更改到origin/master. 在这种情况下,您可以在其他提交的基础上重新提交您的提交。

Your scenario has a commit from a completely different branch. You would either need to merge your other branch into master, or you could cherry pick that one commit and apply to the masterbranch.

您的方案具有来自完全不同分支的提交。您需要将另一个分支合并到master,或者您可以挑选那个提交并应用到该master分支。