我有一个 git 分支(称为 v4) ,它是昨天由 master 制作的。主版本有一些变化,我想进入 V4。因此,在 v4中,我尝试从 master 进行一个 rebase 操作,有一个文件总是把事情搞砸: 一个包含版本号的一行文本文件。这个文件是 app/views/common/version.txt
,在重新定基之前包含以下文本:
v1.4-alpha-02
我是这么做的:
> git rebase master
First, rewinding head to replay your work on top of it...
Applying: new version, new branch
error: patch failed: app/views/common/version.txt:1
error: app/views/common/version.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging app/views/common/version.txt
CONFLICT (content): Merge conflict in app/views/common/version.txt
Failed to merge in the changes.
Patch failed at 0001 new version, new branch
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
version.txt
现在看起来是这样的:
<<<<<<< HEAD:app/views/common/version.txt
v1.4-alpha-02
=======
v1.4-alpha-01
>>>>>>> new version, new branch:app/views/common/version.txt
所以,我整理了一下,现在看起来是这样的:
v1.4-alpha-02
然后我试着继续: 起初我试着承诺:
> git commit -a -m "merged"
# Not currently on any branch.
nothing to commit (working directory clean)
没什么进展,所以,我试着添加文件:
git add app/views/common/version.txt
没有回应。没有消息就是好消息,我想。所以,我试着继续:
> git rebase --continue
Applying: new version, new branch
No changes - did you forget to use 'git add'?
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
It's at this point, after going round and round with this, that I'm banging my head off the desk.
这是怎么回事? 我做错了什么? 有人能教教我吗?
EDIT - for unutbu
我按照您的建议修改了文件,得到了相同的错误:
> git rebase master
First, rewinding head to replay your work on top of it...
Applying: new version, new branch
error: patch failed: app/views/common/version.txt:1
error: app/views/common/version.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging app/views/common/version.txt
CONFLICT (content): Merge conflict in app/views/common/version.txt
Failed to merge in the changes.
Patch failed at 0001 new version, new branch
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".