Slackbot
12/07/2023, 8:38 PMGustavo Nunes Goretkin
12/07/2023, 8:39 PMgit command, also...Jacob Gold
12/07/2023, 8:48 PMNick S
12/07/2023, 8:49 PMgh api /repos/OWNER/REPO/git/refs -f ref='refs/heads/<new_branch_name>' -f sha='commit-sha-to-restore'
It will create a new branch with that shaNick S
12/07/2023, 8:50 PMGustavo Nunes Goretkin
12/07/2023, 9:31 PMgh api command succeeded (and if I run it again it complains "message": "Reference already exists",) but I don't understand how to grab the result. I do not see a new branch on the repository.Nick S
12/07/2023, 9:36 PMNick S
12/07/2023, 9:39 PMgit fetch to see the branch locally firstGustavo Nunes Goretkin
12/07/2023, 9:41 PMGustavo Nunes Goretkin
12/07/2023, 9:43 PM$ gh api /repos/ORG/REPO/git/refs -f ref='refs/head/gng-20231207' -f sha=09491a0921749a8674112a55238210ea6e7ff6cd
{
"ref": "refs/head/gng-20231207",
"node_id": "REF_blahblahblah",
"url": "<https://api.github.com/repos/ORG/REPO/git/refs/head/gng-20231207>",
"object": {
"sha": "09491a0921749a8674112a55238210ea6e7ff6cd",
"type": "commit",
"url": "<https://api.github.com/repos/ORG/REPO/git/commits/09491a0921749a8674112a55238210ea6e7ff6cd>"
}Nick S
12/07/2023, 9:57 PMā git:(main) gh api /repos/<OWNER>/<REPO>/git/refs -f ref='refs/heads/gng-20231207' -f sha='814a4f9fe04460b64613452b0e111eecfbc6c645'
ā git:(main) git fetch
remote: Enumerating objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 1
Unpacking objects: 100% (1/1), 564 bytes | 564.00 KiB/s, done.
From <http://github.com:<OWNER>/<REPO|github.com:<OWNER>/<REPO>>
* [new branch] gng-20231207 -> origin/gng-20231207Nick S
12/07/2023, 9:58 PMrefs/head and I have refs/headsGustavo Nunes Goretkin
12/07/2023, 10:14 PMNick S
12/07/2023, 10:16 PMrefs/head reference with, https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#delete-a-reference
but they may lock it down