Skip to content

Instantly share code, notes, and snippets.

@Hfreitas
Last active May 2, 2024 11:08
Show Gist options
  • Save Hfreitas/227881135b0535e6d8a1d0d261248a98 to your computer and use it in GitHub Desktop.
Save Hfreitas/227881135b0535e6d8a1d0d261248a98 to your computer and use it in GitHub Desktop.
get git repo ref's and upadte branches
mkcd() {
case "$1" in /*) : ;; *) set -- "./$1" ;; esac
mkdir -pv "$1" && cd "$1"
}
git-update-repo() {
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment