Skip to content

Instantly share code, notes, and snippets.

@atomicstack
Created July 19, 2021 13:24
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 atomicstack/e82d92122e1aeb97ef0ff5397d094bd1 to your computer and use it in GitHub Desktop.
Save atomicstack/e82d92122e1aeb97ef0ff5397d094bd1 to your computer and use it in GitHub Desktop.
fixes annoying "error: refs/remotes/origin/${branch_name} does not point to a valid object!"
#!/bin/bash
git for-each-ref --format="%(refname)" | while read ref; do
git show-ref --quiet --verify $ref 2>/dev/null || git update-ref -d $ref
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment