If you have the original remote named remote
and your remote named origin
, try:
git remote update
git remote prune origin
git remote prune remote
You could then find your local branches which are merged in
git branch --merged remote/master
and delete them:
git branch -d <branch>
You could delete all branches merged into the current HEAD with one command:
git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d
Now you should have everything cleared up and you should have a lot less branches.
The actual synchronisation you could achieve with:
git checkout master && git pull --rebase remote master
(If your local branch you want updated is named master
).
You could omit the --rebase
flag if there are a lot of conflicts with the updated remote branch.