git rebase --skip 究竟做了什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9539067/
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
What exactly does git rebase --skip do?
提问by mrwooster
I just did a git pull --rebase origin master
and there was a conflict.
我刚做了一个git pull --rebase origin master
,发生了冲突。
Firstly, this conflict was in a file that I hadnt touched, and was about 10 commits back. Why does this happen?
首先,这个冲突是在我没有接触过的文件中,大约有 10 次提交。为什么会发生这种情况?
I then accidently typed git rebase --skip
, and it 'skipped that patch'.
然后我不小心输入了git rebase --skip
,它“跳过了那个补丁”。
Worried that I had skipped a commit, I checked out a new version of the master branch and did a diff between the branch that I did the rebase on, and the new master branch. The only changes that show up in the diff are the latest commit, and looking at the log, the patch that was 'skipped', shows up in the commit history.
担心我跳过了提交,我检查了一个新版本的 master 分支,并在我做 rebase 的分支和新的 master 分支之间做了一个差异。差异中显示的唯一更改是最新提交,查看日志,“跳过”的补丁显示在提交历史记录中。
Can anyone explain what is going on here?
谁能解释这里发生了什么?
采纳答案by knittl
It does what it says, it skipsa commit. If you run rebase --abort
at a later conflict during the same rebase, the skipped commit will be reverted too of course.
它做它所说的,它跳过一个提交。如果您rebase --abort
在同一个 rebase 期间在以后的冲突中运行,当然也会恢复跳过的提交。
If your change already existed upstream, Git will not be able to apply your commit (but usually should skip it automatically, if the patch is exactly the same). Your own commit will be skipped, but the change will still exist in current HEAD, because it was already applied upstream.
如果您的更改已存在于上游,Git 将无法应用您的提交(但通常应自动跳过它,如果补丁完全相同)。您自己的提交将被跳过,但更改仍将存在于当前 HEAD 中,因为它已在上游应用。
You should really make sure you did not remove an important change of yours ;) (use the reflog to go back to the state before the rebase)
你真的应该确保你没有删除你的重要更改;)(使用 reflog 返回到 rebase 之前的状态)