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 :: how to revert commit in git 
Shell :: ? For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository) 
Shell :: use linux to call via android phone 
Shell :: jenkins as docker container 
Shell :: pacman search 
Shell :: run cron job as specific user 
Shell :: chmod 777 meaning 
Shell :: install virtualbox linux 
Shell :: Move or change directory to specific location in Terminal 
Shell :: git interactive rebase 
Shell :: Install GitLab using Docker Engine 
Shell :: How to delete files in linxu terminal 
Shell :: git the history 
Shell :: jetbrains always add disable 
Shell :: view memory usage linux 
Shell :: create a bootable usb drive ubuntu 
Shell :: which command is used to create a new git repository 
Shell :: docker compose commands 
Shell :: curl command parameters 
Shell :: linux acpi turn display on/off 
Shell :: ssh to lightsail 
Shell :: base64 maintain line breaks linux 
Shell :: dd command to add image to usb 
Shell :: how to send commangds to gitbash from cmd 
Shell :: How to ssh to multiple servers and run commands 
Shell :: minecraft launcher installations gone 
Shell :: surface area of a spherical shell 
Shell :: Show CSF version 
Shell :: Update local clone and rename branch 
Shell :: dev/kdm device permission error android studio 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =