'git log' failed with code 128:'fatal: bad revision '(detached from 35e6d4e)'

sudarshan bhat May 10, 2014

I get this error everytime I try to view status of an unnamed branch. This has been happening for atleast over a year.

Not seeing this error when using command line, or when using other UI tools.

4 answers

1 accepted

1 vote
Answer accepted
sudarshan bhat May 13, 2014
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2014

Thanks for posting the link. I converted this to an answer, and I recommend you accept it as a correct one.

Like 0 es likes this
1 vote
sudarshan bhat May 11, 2015

Thanks Michael, but my issue occurs, and continues to occur when i try to navigate to an unnamed branch - which I do quite a lot when reviewing code or 'git bisect'ing. 

0 votes
Michael Baxter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2015

Late to this party... however I found a solution to this problem that was occurring for me that may assist others:

navigate within finder to location of repository:

path/to/repository/.git/refs/heads

and delete the branches that are causing the issue

path/to/repository/.git/refs/remotes

do the same for any that are causing the issue.

My issue was also caused by dropbox creating a "conflicted-copy" of the heads files, creating ghost branches that weren't showing in SourceTree however they were still triggering an error and showing as valid branches in the ui for pushing to origin, and in the dropdown ui select box above the commit timeline.

Hope it helps others.

0 votes
gustavo_refosco
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2014

Hi Sudarshan,

I've found an Improvement Request related to a similar error message described at https://jira.atlassian.com/browse/SRCTREE-1292that was fixed in SourceTree 1.6, for which this error was happening when SourceTree tries to open orphan branches. Can you please check if this is your case?

If you believe this is related, I'd suggest adding comments to the issue above that you think could be valuable to it.

In case you think this is not related and your case needs further investigation, you might need to create a support ticket at https://support.atlassian.com

sudarshan bhat May 13, 2014

It does sound similar, but I'm on source tree 1.9.2, and am still able to repro the issue. I'll open a support case with steps to repro.

1. on the command line, check out a branch, but don't name it

git checkout origin/<sometopicbranch>

RESULT:

Note: checking out 'origin/<sometopicbranch>'.

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 605262c... formatting changes

2. Launch sourcetree from command line. Make sure the view setting is set to "current branch" and not all branches.

An error message will pop up "'git log' failed with code 128:'fatal: bad revision '(detached from origin/<sometopicbranch>)'"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events