我有以下工作树状态
$ git status foo/bar.txt
# On branch master
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by us: foo/bar.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
文件foo/bar.txt在那里,我想再次进入"未更改状态"(类似于'svn revert'):
$ git checkout HEAD foo/bar.txt
error: path 'foo/bar.txt' is unmerged
$ git reset HEAD foo/bar.txt
Unstaged changes after reset:
M foo/bar.txt
Run Code Online (Sandbox Code Playgroud)
现在它变得令人困惑:
$ git status foo/bar.txt
# …Run Code Online (Sandbox Code Playgroud) 我有一个git分支(称为v4),它是昨天由master制作的.掌握了一些变化,我想进入v4.因此,在第4版中,我尝试从master执行rebase,并且一个文件不断搞砸:一行文本文件,其中包含版本号.此文件是app/views/common/version.txt,在变基之前包含此文本:
v1.4-alpha-02
Run Code Online (Sandbox Code Playgroud)
这是我正在做的事情:
> 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 …Run Code Online (Sandbox Code Playgroud)