KoenvE
KoenvE

Reputation: 157

Fixing detached branches in Git

I've used the script provided by GitHub to change author info of a GIT repository. While running the script there were some errors which resulted in each branch being duplicated as the origin. I need to keep the origin branches and delete the others. I can't switch to the origin branches because it throws an error:

fatal: A branch named 'Development' already exists.

How can I restore my repository to only keep the origin branches? My branches look like this in sourcetree:

sourcetree

Upvotes: 2

Views: 1942

Answers (1)

VonC
VonC

Reputation: 1324278

You could reset your Development branch to the origin one:

git checkout Development
git reset --hard origin/Development

That should be enough.

Upvotes: 3

Related Questions