简体   繁体   中英

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:

源树

You could reset your Development branch to the origin one:

git checkout Development
git reset --hard origin/Development

That should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM