I accidentally locally deleted a GitHub branch with an ongoing PR. How can I restore it locally so that I can continue making and pushing modifications to the PR?
Asked
Active
Viewed 44 times
0
-
1Use the reflog. `git reflog` – evolutionxbox May 05 '22 at 07:39
-
I am not sure if it will work, it happened like a week ago or something. How would I formulate the command in that case? – user9328894 May 05 '22 at 08:06
1 Answers
0
I found the answer I was looking for here: How to download a branch with git?
git checkout -t origin/branch-name

user9328894
- 31
- 4
-
-
It does, it allows you to restore on your local machine a branch that you had previously deleted in your local repository and continue with an ongoing PR. – user9328894 May 09 '22 at 11:48
-
That's not the question though, since it won't continue from the local commits. – evolutionxbox May 09 '22 at 13:54
-
It will continue with the local commits, the -t stands for track, so if you make a change locally and commit it, it will go directly to the PR. I have tried it and it worked. – user9328894 May 10 '22 at 07:20