Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prune all git remotes

Tags:

git

Does Git have anything akin to git remote prune --all to automatically prune all remotes in a repository? Is there anything more built-in (or elegant) than this bash loop I've used?

for REMOTE in `git remote`; do git remote prune $REMOTE; done
like image 916
TravisCarden Avatar asked May 13 '13 19:05

TravisCarden


People also ask

How do I run git remote trim origin?

Prune/Cleanup the local references to remote branch The command git remote prune origin --dry-run lists branches that can be deleted/pruned on your local. An option --dry-run is needed. Now go ahead and actually prune/cleanup the local references by running the command git remote prune origin .

How do I clean up remote branches?

In order to clean up remote-tracking branches while fetching, use the “git fetch” command with the “–prune” option. Alternatively, you can simply use the “-p” shortcut instead of typing “prune” every time.

How do I trim a git repository?

remove the file from your project's current file-tree. remove the file from repository history — rewriting Git history, deleting the file from all commits containing it. remove all reflog history that refers to the old commit history. repack the repository, garbage-collecting the now-unused data using git gc.


1 Answers

It turns out Git does have this functionality, and it can be accomplished one of two ways:

  1. git remote update --prune (ht. morty)
  2. git fetch --prune --all
like image 79
TravisCarden Avatar answered Sep 18 '22 01:09

TravisCarden