I accidently did this:
$ git push origin :development
To [email protected]:yyyyy/projects/web.git
- [deleted] development
How do I undo? What is the second best thing I can do?
A deleted Git branch can be restored at any time, regardless of when it was deleted. Open your repo on the web and select the Branches view. Search for the exact branch name using the Search all branches box in the upper right. Click the link to Search for exact match in deleted branches.
Restoring a deleted branchUnder your repository name, click Pull requests. Click Closed to see a list of closed pull requests. In the list of pull requests, click the pull request that's associated with the branch that you want to restore. Near the bottom of the pull request, click Restore branch.
Steps to delete remote Git branchesIssue the git push origin –delete branch-name command, or use the vendor's online UI to perform a branch deletion. After the remote branch is deleted, then delete the remote tracking branch with the git fetch origin –prune command.
If your branch was fairly up-to-date with the remote one, a simple:
git push origin development:development
should be enough, as illustrated by this thread.
If not, a local action needs to be done on the remote server side (through reflog or fsck
) to retrieve the branch HEAD SHA1 id and checkout it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With