# "Not currently on any branch"

5 messages from 2009-10-02 to 2009-10-04. Participants: Tim, Steven Noonan, Alex Riesen, Sean Estabrooks, Clemens Buchacher.
Thread: https://gitlist.dev/t/21116

## Tim, 2009-10-02 20:08

Subject: "Not currently on any branch"
Message-ID: <loom.20091002T215942-663@post.gmane.org>
URL: https://gitlist.dev/e/loom.20091002T215942-663%40post.gmane.org

```
I have some code in a git repo that is "Not currently on any branch". Now,
there's the master branch and another branch 'ui-integration' that I'm using in
this project. I don't know how the project got into this headless state, but I
need to be using the 'ui-integration' branch. 

I tried looking around the blogosphere for a solution, and tried what I found
here. But it seems like only my last commit (not the previous 10 I made) shows
up in the master branch (not ui-integration ).  
http://blog.kortina.net/post/71935540/fix-git-not-currently-on-any-branch-problem

What's the most straightforward & cleanest way to merge my changes in the
headless branch to my 'ui-integration' branch? 

Thanks in advance
Tim

```

## Steven Noonan, 2009-10-02 20:58

Subject: Re: "Not currently on any branch"
Message-ID: <f488382f0910021358nc4a8c2ehca665c47aa39224c@mail.gmail.com>
URL: https://gitlist.dev/e/f488382f0910021358nc4a8c2ehca665c47aa39224c%40mail.gmail.com
In-Reply-To: <loom.20091002T215942-663@post.gmane.org>

```
On Fri, Oct 2, 2009 at 1:08 PM, Tim <timothyjwashington@yahoo.ca> wrote:
> I have some code in a git repo that is "Not currently on any branch". Now,
> there's the master branch and another branch 'ui-integration' that I'm using in
> this project. I don't know how the project got into this headless state, but I
> need to be using the 'ui-integration' branch.
>
> I tried looking around the blogosphere for a solution, and tried what I found
> here. But it seems like only my last commit (not the previous 10 I made) shows
> up in the master branch (not ui-integration ).
> http://blog.kortina.net/post/71935540/fix-git-not-currently-on-any-branch-problem
>
> What's the most straightforward & cleanest way to merge my changes in the
> headless branch to my 'ui-integration' branch?
>

Try 'git checkout -b temp', which creates a branch called 'temp' with
its HEAD at where you currently are, and then merge your changes to
ui-integration via 'git checkout ui-integration; git merge temp', and
finally drop the junk branch with 'git branch -d temp'

- Steven

```

## Alex Riesen, 2009-10-02 21:46

Subject: Re: "Not currently on any branch"
Message-ID: <81b0412b0910021446nb07e7e9l465f588168297fe9@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0910021446nb07e7e9l465f588168297fe9%40mail.gmail.com
In-Reply-To: <loom.20091002T215942-663@post.gmane.org>

```
On Fri, Oct 2, 2009 at 22:08, Tim <timothyjwashington@yahoo.ca> wrote:
> What's the most straightforward & cleanest way to merge my changes in the
> headless branch to my 'ui-integration' branch?

Assuming you use a Bourne shell:

$ prev=$(git rev-parse HEAD)
$ git checkout ui-integration && git merge $prev

```

## Sean Estabrooks, 2009-10-02 23:15

Subject: Re: "Not currently on any branch"
Message-ID: <BLU0-SMTP927FF0174DF8AAD58644A8AED20@phx.gbl>
URL: https://gitlist.dev/e/BLU0-SMTP927FF0174DF8AAD58644A8AED20%40phx.gbl
In-Reply-To: <81b0412b0910021446nb07e7e9l465f588168297fe9@mail.gmail.com>

```
On Fri, 2 Oct 2009 23:46:53 +0200
Alex Riesen <raa.lkml@gmail.com> wrote:

> On Fri, Oct 2, 2009 at 22:08, Tim <timothyjwashington@yahoo.ca> wrote:
> > What's the most straightforward & cleanest way to merge my changes in the
> > headless branch to my 'ui-integration' branch?
> 
> Assuming you use a Bourne shell:
> 
> $ prev=$(git rev-parse HEAD)
> $ git checkout ui-integration && git merge $prev
> 
> 

You could also rely on the reflog to avoid the need to store off the
previous HEAD value, so just:

$ git checkout ui-integration && git merge HEAD@{1}


Sean

```

## Clemens Buchacher, 2009-10-04 07:22

Subject: Re: "Not currently on any branch"
Message-ID: <20091004072229.GA14142@localhost>
URL: https://gitlist.dev/e/20091004072229.GA14142%40localhost
In-Reply-To: <loom.20091002T215942-663@post.gmane.org>

```
On Fri, Oct 02, 2009 at 08:08:52PM +0000, Tim wrote:
> I have some code in a git repo that is "Not currently on any branch". Now,
> there's the master branch and another branch 'ui-integration' that I'm
> using in this project. I don't know how the project got into this headless
> state, but I need to be using the 'ui-integration' branch. 

It can happen either by explicitly detaching HEAD using "git checkout
<commit>", or if you used rebase and it is still in progress.

Clemens

```
