'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.

5 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 1 person 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>


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:


and delete the branches that are causing the issue


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


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,229 views 4 2
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you