【发布时间】:2016-03-15 04:58:02
【问题描述】:
我运行git checkout <commid-id>,一旦 HEAD 处于分离状态,我就在分离状态下进行了很少的提交。然后我创建了一个名为 developer 的分支,以便我在分离状态下所做的所有提交都进入我的 developer 分支。现在我运行命令git checkout developer,然后运行git rebase master。我得到了一些相互冲突的更改,然后我关闭了终端。
下次我打开并运行git rebase master 时,我收到了以下消息
It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase. If that is the
case, please try
git rebase (--continue | --abort | --skip)
If that is not the case, please
rm -fr "/Users/pl1/my_project/.git/rebase-apply"
and run me again. I am stopping in case you still have something
valuable there.
我运行了以下命令 rm -fr "/Users/pl1/my-project/.git/rebase-apply"
现在,当我运行 git branch 命令时,我得到以下信息:
*(detached from refs/heads/developer)
developer
master
我再次运行git rebase master 命令。收到以下消息:
Cannot rebase: You have unstaged changes.
Additionally, your index contains uncommitted changes.
Please commit or stash them.
现在运行git status 命令给出:
HEAD detached from refs/heads/developer
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: client/app/filterEnv/filterEnv.directive.js
modified: client/app/filterEnv/filterEnv.html
modified: client/app/filterEnv/filterEnv.scss
modified: client/app/hostsTable/hostsTable.directive.js
modified: client/app/main/main.html
modified: client/app/results/results.html
modified: package.json
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: root@remotehost.corp.net
我对自己目前的状态感到困惑。如何从这里将我的开发人员分支更改重新设置为 master。我在developer 分支中的更改现在丢失了吗?请让我知道,因为我是运行git rebase 命令的新手。
【问题讨论】:
-
一开始你为什么要在分离的头部状态下工作?这通常是出于探索性原因。如果您想要来自
master的分支,那么只需在那里创建并完成您的工作。还有,你为什么要基于master?当你进入超然状态时,你在哪?
标签: git git-branch git-rebase