Skip to content

Instantly share code, notes, and snippets.

@joshuaflanagan
Created December 17, 2014 01:46
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 joshuaflanagan/523aeec5fceb3bc75691 to your computer and use it in GitHub Desktop.
Save joshuaflanagan/523aeec5fceb3bc75691 to your computer and use it in GitHub Desktop.
Recover a branch when you know the SHA, but don't have it locally
http -v -a username:password POST https://api.github.com/repos/owner/repo/git/refs ref="refs/heads/recovered_branch" sha="290b2090a741d35edd67f15c74b2d43299df8995"
git fetch
git checkout recovered_branch
@joshuaflanagan
Copy link
Author

Example uses httpie command line utility, but you could create a curl equivalent.

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