Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git undo deleted local branch

git reflog //You can use git reflog to find the SHA1 of the last commit of the branch.
From that point, you can recreate a branch using

git branch branchName <sha1>

user@MY-PC /C/MyRepo (master)
$ git branch -D master2
Deleted branch master2 (was 130d7ba).    <-- This is the SHA1 we need to restore it!

user@MY-PC /C/MyRepo (master)
$ git branch master2 130d7ba
Comment

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.
Comment

git bring back deleted branch from local

user@MY-PC /C/MyRepo (master)
$ git branch -D master2
Deleted branch master2 (was 130d7ba).    <-- This is the SHA1 we need to restore it!

user@MY-PC /C/MyRepo (master)
$ git branch master2 130d7ba
Comment

PREVIOUS NEXT
Code Example
Shell :: there are insecure directories /usr/local/share/zsh 
Shell :: nvm cheatsheet 
Shell :: using yarn in docker 
Shell :: check active ssh users in linux 
Shell :: brew install node sass 
Shell :: linux shell parameter 
Shell :: lenovo touchpad not working ubuntu 
Shell :: vim exit 
Shell :: how to start xammp on linux 
Shell :: bash if is link simbolico 
Shell :: install teamviewer ubuntu 18 
Shell :: lumen with specific version 
Shell :: git how to roll back to a commit 
Shell :: bash command to clean up log files in /var/log 
Shell :: brave installation ubuntu 
Shell :: append to a file from terminal 
Shell :: ssh key gen 
Shell :: how to create permanent alias in linux 
Shell :: install nix macos 
Shell :: gtk4 windows install 
Shell :: docker compose stop and start only specific 
Shell :: setup systemd redis 
Shell :: terraform install on ubuntu 
Shell :: configure static ip address linux 
Shell :: git submodule push current branch to master 
Shell :: how to remove a software from linux 
Shell :: $$ in shell script 
Shell :: android debug keystore windows 
Shell :: nvcc not working after installing cuda 
Shell :: kube log 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =