Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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