Skip to content

Instantly share code, notes, and snippets.

@aaronsummers
Last active November 20, 2023 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronsummers/232cfd3ee620695fc492349cd7c0973a to your computer and use it in GitHub Desktop.
Save aaronsummers/232cfd3ee620695fc492349cd7c0973a to your computer and use it in GitHub Desktop.
GIT housekeeping

Delete and update the ignored files in your local repository.

git rm -r --cached . && git add . && git commit -am "Remove ignored files"

Remove branches not on the remote.

  1. Switch to the master branch
  2. Run this command:
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d

Remove tags added to a GIT repository

Stackoverflow

git push --delete origin YOUR_TAG_NAME

Stackoverflow

git tag -d YOUR_TAG_NAME

Remove local branches not on the remote. (Prune)

git fetch -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment