On Wed, 10 Jun 2015 08:28:19 -0700 (PDT)
Bhargavi V <umail.bharg...@gmail.com> wrote:
> I have the head detached for my remote origin/develop branch.
Terminology warning: the HEAD being in a detached state precisely means
that it's no longer associated with any branch -- that's why it's
detached after all. So you can't really say that you have the HEAD
detached _for_ some branch: your origin/develop branch still has its
own tip intact -- available through using that name "origin/develop".
> I was not sure of my previous actions that resulted this but I
> remember getting a message saying the origin/develop diverged from
> develop (don't know if it is relevant).
Supposedly this only means that you have a local branch named
"develop", and it's "set to track" the remote branch "origin/develop".
Tracking is used to assist the user in a common case: when a local
branch is logically bound with a remote branch. When a local branch is
set to track a remote branch, certain Git commands start hinting you
about the relation of commits in these branches.
You can start with  to learn more about this concept.
And no, this is not relevant to the problem at hand.
> Anyways, I tried creating a temp branch and forcing the head of
> origin/develop to that temp but I am unable to solve this issue.
Do you really want to mess with origin/develop?
The origin/develop is a so-called "remote branch".
The core idea behind remote branches is that they are sort of bookmarks
to the state of a particular remote repository. Say, you run
`git fetch origin`, and when it completes your remote branches having
the "origin/" prefix are updated to mirror what tips their matching
branches on the remote "origin" contained when fetching run.
These branches are hence only for reference: they are there to not
require you reach for a remote repository each time you want to work
with a remote branch -- inspect its history, merge with your local
branch etc. That's why you never work directly on remote branches, and
never manipulate them directly.
I think that your origin/devel is just OK, and the real question is
what do you want to do with the work you did while having been in the
detached HEAD state. Am I right on this?
If yes, then first make sure you saved your work: tag your HEAD commit
or make a branch out of it:
git tag temp
git branch temp
It seems that you've already managed to do that though...
The next thing is to decide what to do with those commits.
To me, it appears they were intended to be done on "develop" instead,
right? If yes, cherry-picking seems like the best bet.
Inspect what was done on the temp branch using `git log temp`
and identify commits you want on your "develop".
Then check the "develop" branch out and use a series of calls to
git cherry-pick <commit>
passing it commits you want to get applied -- starting from the oldest.
(This can be automated but let's not touch this for now.)
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.