$ git remote add upstream git@github.com:main-repo.git
$ git fetch upstream
$ git branch --set-upstream-to=upstream/master master
$ git remote set-url origin ???url
git remote prune origin prunes
tracking branches not on the remotegit branch --merged
lists branches that have been merged into the current branch.xargs git branch -d
deletes branches listed on standard input.- Be careful deleting branches listed by
git branch --merged
. The list could include master or other branches you'd prefer not to delete.
To give yourself the opportunity to edit the list before deleting branches, you could do the following in one line:
git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"