'git log' failed with code 128:'fatal: bad revision 'BranchName' '

Since deleting the local branch "BranchName" by right+clicking -> Delete BranchName, I get the above error message on every command I trigger from SourceTree. Everything seems to work though.

The branch did never exist on the remote and is deleted locally. Using git from the command line is working without complains.

git branch does not list the deleted branch. I "git clean -fd". "git log" also works with no issues.


OSX 10.9.2

Sourcetree Version 1.9.4 (1.9.4) (update installed today)

6 answers

1 accepted

17 votes
Accepted answer

I could fix workaround the issue by:

- close Sourcetree window

- open Sourcetree Bookmarks view

- delete bookmark

- add bookmark again

It works as well.

Works. Thanks a lot!

That's not a fix, just a temporary workaround.
Next time you switch branch and delete old branch this bug will appear again 

Doesn't seem to be working for me on Mac
Found this, which is a the right route for a permanent fix in the source https://jira.atlassian.com/browse/SRCTREE-2355 

It works for me too . Thanks you

Thanks this work around worked on Mac - OSx 10.11.6 & Source Tree Version 2.3.1 (69)

This issue really needs a fix.

It's march 2017 and I still have this issue 8-/

I'm seeing this also. This should have been resolved long ago at this stage.

Should not be marked as solved.

I think that I have the same problem.

1. Have a repo where git status reports 'HEAD detached at tfs/default'

2. Add repository to Sourcetree

3. Double-click repository

4. Error encountered: 'git log' failed with code 128:'fatal: bad revision 'master''

check the contents of .git/config  - delete the remote branch reference which no longer exists.

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

962 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