Skip to content

Instantly share code, notes, and snippets.

@Gopikrishna19
Created February 26, 2019 14:37
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 Gopikrishna19/5e68a8bce72eed7b1652778fdaf0975d to your computer and use it in GitHub Desktop.
Save Gopikrishna19/5e68a8bce72eed7b1652778fdaf0975d to your computer and use it in GitHub Desktop.
Restore deleted branch

knowing the github reference

# GIT_PAT=
# GIT_USER=
# GIT_ORG=
# GIT_REPO=
# GIT_REMOTE=
# GIT_BRANCH=

curl -i \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"ref":"refs/heads/${GIT_BRANCH}", "sha":"${GIT_SHA}"}' \
  -u ${GIT_USER}:${GIT_PAT} 
  https://${GIT_REMOTE}/api/v3/repos/${GIT_USER}/${GIT_REPO}/git/refs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment