Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing broken names in Git (dropbox conflicted copy)

Tags:

git

dropbox

I save my repo in dropbox, and one day (see date below) it went crazy. Now I get these warning every time I try to autocomplete a branch name

warning: ignoring ref with broken name refs/heads/develop (MacBook Pro's conflicted copy 2015-02-28)
warning: ignoring ref with broken name refs/heads/master (MacBook Pro's conflicted copy 2015-02-28)
warning: ignoring ref with broken name refs/remotes/origin/develop (MacBook Pro's conflicted copy 2015-02-28)
warning: ignoring ref with broken name refs/remotes/origin/master (MacBook Pro's conflicted copy 2015-02-28)
warning: ignoring ref with broken name refs/remotes/production/master (MacBook Pro's conflicted copy 2015-02-28)

How do I fix these warning?

Note: For all the duplicate-trigger-happy people - this is not a dup! I just want to remove the references above to stop getting the warning. The git repo is intact

like image 475
Nick Ginanto Avatar asked Mar 06 '15 07:03

Nick Ginanto


2 Answers

when dropbox finds conflicting files, it renames those to filename (conflicted copy) (as you might know). So you just have to rename again those files:

This might be a rather delicate exercise since you will be messing inside your git directory; better take a copy of your whole repository first. Now go into this directory

cd <repo>/.git/refs/heads

where you will find those badly renamed files. You'll have to check which one to keep (the normal or then conflicting copy), and remove the unwanted, renaming the conflicting copies as necessary. You'll have to do the same in the other directory:

<repo>/.git/refs/remotes

EDIT: each of the files you'll find just contains the hash of the commit they are pointing at. So if you want to check which one to keep; check which of the commits really exists, and where you want those references to point to.

like image 66
Chris Maes Avatar answered Oct 28 '22 07:10

Chris Maes


I got this warning possibly after updating my git version (ubuntu 15.04 to 15.10) and needed only to remove directories in .git/refs/remotes for old dangling remotes I no longer actually had configured.

like image 29
Eric Woodruff Avatar answered Oct 28 '22 08:10

Eric Woodruff