deleted git branch code example

Example 1: delete branch from remote

// delete branch locally
git branch -d localBranchName

//delete local branch that is unmerged
git branch -D localBranchName

// delete branch remotely
git push origin --delete remoteBranchName

Example 2: delete remote git branch

git push --delete remoteName branchName

Example 3: delete branch

// delete branch locally
git branch -D localBranchName

// delete branch remotely
git push origin --delete remoteBranchName

Example 4: how to restore deleted branch in git

Yes, you should be able to do git reflog --no-abbrev and find the SHA1 for 
the commit at the tip of your deleted branch, then just git checkout [sha].
And once you're at that commit, you can just git checkout -b [branchname] to
recreate the branch from there.