Git

delete all merged branches

delete all remote branches that have already been merged into master 1

git push origin --delete $(git branch -r --merged origin/master \
| grep origin \
| egrep -v '>|master|develop' \
| cut -d/ -f2-)

This can produce errors with refs. If this happens I recommend:

git branch -r --merged origin/master \
| grep origin \
| egrep -v '>|master|develop' \
| cut -d/ -f2- > all.txt

putting all the errors in to error.txt

then running:

comm -23 all.txt error.txt > delete.txt

-23 suppresses the lines that are in both files, or only in file 2. The files have to be sorted (they are in your example) but if not, pipe them through sort first...2

removing references to deleted remote branches

This command show the remote branch, but it sometimes shows branches that have been deleted.

To remove them

Syncing a fork

Configuring a remote for a fork

  • List the current configured remote repository for your fork.

  • Specify a new remote upstream repository that will be synced with the fork.

  • Verify the new upstream repository you've specified for your fork.

    Syncing a fork

    Sync a fork of a repository to keep it up-to-date with the upstream repository.

  • Change the current working directory to your local project.

  • Fetch the branches and their respective commits from the upstream repository. Commits to ''master'' will be stored in a local branch, ''upstream/master''.

  • Check out your fork's local ''master'' branch.

  • Merge the changes from ''upstream/master'' into your local ''master'' branch. This brings your fork's ''master'' branch into sync with the upstream repository, without losing your local changes.

Get all tags

Last updated