我有一个 git 分支(称为 v4),它是昨天由 master 制作的。对 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".
正是在这一点上,在绕着这个转圈之后,我把头从桌子上撞了下来。
这里发生了什么?我究竟做错了什么?谁能让我直截了当?
编辑 - 为 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".