Nemo

Nemo 关注TA

路漫漫其修远兮,吾将上下而求索。

Nemo

Nemo

关注TA

路漫漫其修远兮,吾将上下而求索。

  • 加入社区3,280天
  • 写了1,496,113字

该文章投稿至Nemo社区   编程综合  板块 复制链接


Not currently on any branch.

发布于 2017/03/08 16:46 3,338浏览 0回复 1,203

git rebase后发现命令错误,赶紧ctrl + c撤销操作。重新rebase后提交发现失败,然后就发现了如下的问题。

nemo@Cynthia:~/git_work01/lambda$ git status

Not currently on any branch.

nothing to commit, working directory clean


解决方案如下:

切换到该分支

git checkout origin/dev_s17_1

这时候会发现

nemo@Cynthia:~/git_work01/lambda$ git status
HEAD detached at origin/dev_s17_1
nothing to commit, working directory clean

接着切换到该具体分支:

nemo@Cynthia:~/git_work01/lambda$ git checkout dev_s17_1
Warning: you are leaving 1 commit behind, not connected to
any of your branches:

  9a76242 xxxxxxxxxxxxxxxxxxx。

If you want to keep it by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> 9a76242

Switched to branch 'dev_s17_1'
Your branch and 'origin/dev_s17_1' have diverged,
and have 1 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

再看状态会发现此时已经回到正常的分支状态下了:

nemo@Cynthia:~/git_work01/lambda$ git status
On branch dev_s17_1
Your branch and 'origin/dev_s17_1' have diverged,
and have 1 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean

这时候再重新执行rebase,重新提交代码即可。

本文标签
 {{tag}}
点了个评