Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Shallow Thought June 10, 2014

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.

System:

OSX 10.9.2

Sourcetree Version 1.9.4 (1.9.4) (update installed today)

8 answers

1 accepted

21 votes
Answer accepted
Shallow Thought June 10, 2014

I could fix workaround the issue by:

- close Sourcetree window

- open Sourcetree Bookmarks view

- delete bookmark

- add bookmark again

sangkwon May 27, 2015

It works as well.

Jos September 21, 2016

Works. Thanks a lot!

AAverin September 24, 2016

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

g5coderswartz September 30, 2016

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 

Patrick Leclerc February 3, 2017

It works for me too . Thanks you

Greg Buresch March 19, 2017

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

Arjav Lad March 13, 2019

This worked, thanks

5 votes
AAverin September 24, 2016

This issue really needs a fix.

1 vote
Deleted user May 30, 2018

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

1 vote
chornsec March 5, 2018

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

1 vote
damien_friday July 20, 2017

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

Should not be marked as solved.

1 vote
Jos March 2, 2017

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

0 votes
Matt Collins August 31, 2022

I had this issue occur recently on macOS, in what felt like out of the blue, which lead me here.  

In case it's helpful for anyone else, one thing I did was run `git gc`, which gave me two errors:

  • fatal: bad object refs/remotes/origin/[branch name]
  • fatal: failed to run repack

The branch name here was the same as the 'fatal: bad revision [branch name]' error, so I figured they were related.  In my case, the branch name specified wasn't valid (or was no longer valid?), so I just deleted it.  Afterwards, I closed the SourceTree window and re-opened it to find it working again.

Weird. 

0 votes
Tessy Ahado April 29, 2019

I had the issue. In my case here is what I,Ve done to solve it.

 

CONTEXT:

It was related to certains type of files in my .gitattributes file.

The line filter "*.myext filter=lfs diff=lfs merge=lfs -text" in gitattributes file was added AFTER some ".myext" file were previously commited in the repository.

The ".myext" files were never been modified following the addition in the ".gitattributes" file.

 

SOLUTION:

- Clone the repository ( D:\My_Repo )

- Made a copy of all the content of the repository (excluding .git folder) in a temporary folder ( D:\My_Repo_tmp )

- Overwrite all the content of "D:\My_Repo" with the content of "D:\My_Repo_tmp"

- Commit and push to remote branch the changes detected.

 

OVERALL:

It forces git to push back the content that have not been pushed yet to LFS and regenerate the links to LFS.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events