简体   繁体   中英

git branch is in detached from refs/heads/developer

I run the git checkout <commid-id> and once the HEAD was in detached state, I made few commits to in the detached state. Then I created the branch called developer so that all the commits that I did when in detached state came inside my developer branch. Now I ran the command git checkout developer and then git rebase master . I got few conflicting changes and then I closed the terminal.

The next time I opened and ran the git rebase master I got the below message

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.

I ran the below command rm -fr "/Users/pl1/my-project/.git/rebase-apply"

Now when I run the git branch command I get the below:

*(detached from refs/heads/developer)
  developer
  master

I ran the git rebase master command once again. Got the below message:

Cannot rebase: You have unstaged changes.
Additionally, your index contains uncommitted changes.
Please commit or stash them.

Running git status command now gives:

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

I am confused with my current state. How to rebase my developer branch changes to master from here. Is my changes inside the developer branch lost now? Please let me know since I am new to running the git rebase command.

It looks like you never did git rebase --continue to continue the rebase after the stop. This is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM