From 8dd641c0dbc6fa17dfda8296f8a100d411b92533 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 9 Oct 2015 11:37:28 -0500 Subject: [PATCH] Add Clean Up Old Remote Tracking References as a git til. --- README.md | 1 + git/clean-up-old-remote-tracking-references.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 git/clean-up-old-remote-tracking-references.md diff --git a/README.md b/README.md index d4d616f..ff4ce21 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md) - [Checkout Previous Branch](git/checkout-previous-branch.md) - [Clean Out All Local Branches](git/clean-out-all-local-branches.md) +- [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md) - [Delete All Untracked Files](git/delete-all-untracked-files.md) - [Determine The Hash Id For A Blob](git/determine-the-hash-id-for-a-blob.md) - [Dry Runs in Git](git/dry-runs-in-git.md) diff --git a/git/clean-up-old-remote-tracking-references.md b/git/clean-up-old-remote-tracking-references.md new file mode 100644 index 0000000..679807c --- /dev/null +++ b/git/clean-up-old-remote-tracking-references.md @@ -0,0 +1,17 @@ +# Clean Up Old Remote Tracking References + +After working on a Git-versioned project for a while, you may find that +there are a bunch of references to remote branches in your local repository. +You know those branches definitely don't exist on the remote server and +you've removed the local branches, but +you still have references to them lying around. You can reconcile this +discrepancy with one command: + +```bash +$ git fetch origin --prune +``` + +This will prune all those non-existent remote tracking references which is +sure to clean up your git log (`git log --graph`). + +[source](http://stackoverflow.com/a/3184742/535590)