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 :: download mongodb ubuntu 20.04 
Shell :: installing mutillidae in kali 
Shell :: Remove a file from a Git repository without deleting it from the local 
Shell :: serverless deploy missing credentials in config 
Shell :: install stylelint 
Shell :: how to install zsh using brew 
Shell :: javascript implements 
Shell :: store pass git 
Shell :: install spotify on ubuntu 
Shell :: cent os 8 delete all packages 
Shell :: gitlab push to create 
Shell :: add text to clipboard wsl 
Shell :: check which python script is running 
Shell :: how to install wsl 2 
Shell :: add co author git 
Shell :: powershell filter 
Shell :: store env file in firebase functions 
Shell :: how to make ubuntu use all available disk 
Shell :: tailwind installation 
Shell :: git merge tag to branch and squash commits 
Shell :: ionic capacitor ios 
Shell :: open a file in linux 
Shell :: Create and edit a new file nano 
Shell :: dockerfile copy folder to container 
Shell :: how to git clone a branch github 
Shell :: install wordpress linux 
Shell :: Building without Cython. Error: Please make sure the libxml2 and libxslt development packages are installed. 
Shell :: allure report history 
Shell :: install mavros on ubuntu 
Shell :: ufw enable no disrupt 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =