It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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. 

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

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>)'"

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,895 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you