Reputation: 95
well, I've made a very terrible mistake which first I just want to delete the remote connection to another repositories.
I've made the command like this: git push dev :test
which after I check on the github, I'm just realize that the branch test already deleted.
Question: how can I get the branch back? Is it possible to undo the command which I've already made?
Upvotes: 4
Views: 5819
Reputation: 3459
Do you still have the local copy with you? Run git branch
to check, you probably still have your local branch there since you don't mention removing the local branch.
If this is this case, just push to the remote repository again, with git push dev test
without the colon.
Upvotes: 6
Reputation: 387527
I have the branch on my repositories.
If you haven’t removed it in your local repository yet, you can just push it again to recreate it.
git push dev localbranch:test
Or if you don’t have the branch itself, but still remember which commit was on top, you can also just push that commit directly:
git push dev some-commit-hash:test
Upvotes: 0
Reputation: 876
that's not possible to recover after a remote branch is deleted.
since git is DVCS, you'd pray that others didn't get their local copy updated,
let them help forth push your test
branch into remote.
that's the only way to get your branch back, I guess.
since you're in github, maybe there're some forks available? that's also an alternative.
Upvotes: -1