When a feature branch finished using git flow
then it may still in the local branch on another developer machine.
So to keep updated your local branches with remote branches you need to clean up your local branches that aren’t on the remote.
Follow this to clean up & get synced with the remote origin –
- To clean up information of local branches with remote. Run –
git fetch --prune
- Delete branches that aren’t on remote. Run –
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
If you face error like this –error: The branch my_local_test_branch is not fully merged
Use -D
to force the delete for unmerged branches.
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
No Comments
Leave a comment Cancel