Skip to main content
ubuntuask.com

Back to all posts

How to Branch From Deleted Branch In Git?

Published on
4 min read
How to Branch From Deleted Branch In Git? image

Best Git Tools to Buy in November 2025

1 Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

  • VERSATILE TOOLSET FOR EVERYDAY TASKS-PERFECT FOR DIY ENTHUSIASTS!
  • UPGRADED CORDLESS SCREWDRIVER WITH LED & POWER GAUGE FOR CONVENIENCE!
  • PURCHASE TODAY AND SUPPORT BREAST CANCER RESEARCH WITH YOUR BUY!
BUY & SAVE
$34.99 $69.99
Save 50%
Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1
2 Learning Git: A Hands-On and Visual Guide to the Basics of Git

Learning Git: A Hands-On and Visual Guide to the Basics of Git

BUY & SAVE
$34.92 $45.99
Save 24%
Learning Git: A Hands-On and Visual Guide to the Basics of Git
3 CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

  • ALL-IN-ONE TOOL SET FOR SMALL REPAIRS & DIY PROJECTS
  • DURABLE, CORROSION-RESISTANT TOOLS FOR LONG-LASTING USE
  • STYLISH PINK TOOLKIT, PERFECT GIFT FOR DIY ENTHUSIASTS
BUY & SAVE
$22.99 $24.99
Save 8%
CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink
4 Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

BUY & SAVE
$43.23 $65.99
Save 34%
Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development
5 FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

  • COMPLETE TOOL KIT FOR ALL DIY PROJECTS AND HOME REPAIRS.
  • DURABLE FORGED STEEL PLIERS ENSURE STRENGTH FOR TOUGH TASKS.
  • STYLISH PINK DESIGN MAKES IT A PERFECT GIFT FOR ANY OCCASION.
BUY & SAVE
$59.99 $66.99
Save 10%
FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag
6 Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

  • ALL-IN-ONE TOOL KIT FOR EVERY HOUSEHOLD MAINTENANCE NEED!

  • COMPACT DESIGN: STORE EASILY IN ANY SPACE OR VEHICLE!

  • VERSATILE FOR REPAIRS, ASSEMBLY, AND DIY PROJECTS AT HOME!

BUY & SAVE
$9.56
Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black
7 5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting

5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting

  • HIGH-QUALITY STEEL CONSTRUCTION FOR DURABILITY AND EASE OF USE.

  • VERSATILE TOOLS FOR JEWELRY MAKING, REPAIR, AND DIY CRAFTS.

  • IDEAL GIFT FOR DIY ENTHUSIASTS AND JEWELRY CRAFTERS.

BUY & SAVE
$11.99
5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting
8 VCELINK Wire Stripper and Cutter, Professional Quick Strip Automatic Wire Stripper, 2 in 1 Adjustable Electrical Cable Wire Stripping Tool&Eagle Nose Self-Adjusting Wire Pliers (7-Inch)

VCELINK Wire Stripper and Cutter, Professional Quick Strip Automatic Wire Stripper, 2 in 1 Adjustable Electrical Cable Wire Stripping Tool&Eagle Nose Self-Adjusting Wire Pliers (7-Inch)

  • EFFORTLESSLY STRIP WIRES WITH THE 2-IN-1 TOOL’S SPRING-LOADED DESIGN.

  • COMPACT AND LIGHTWEIGHT, PERFECT FOR DIYERS AND PROFESSIONAL ELECTRICIANS.

  • ADJUSTABLE PRESSURE ENSURES CLEAN STRIPS WITHOUT DAMAGING WIRE CORES.

BUY & SAVE
$9.99
VCELINK Wire Stripper and Cutter, Professional Quick Strip Automatic Wire Stripper, 2 in 1 Adjustable Electrical Cable Wire Stripping Tool&Eagle Nose Self-Adjusting Wire Pliers (7-Inch)
+
ONE MORE?

If you have deleted a branch in Git, you can still access its commit history and files by creating a new branch that points to the same commit where the deleted branch was last pointing. To do this, you can use the reflog command to retrieve the commit hash of the deleted branch, and then create a new branch using that commit hash. This allows you to "branch" off from the deleted branch and continue working on the code. Additionally, you can also use the git branch -f command to directly create a new branch at the commit that the deleted branch was pointing to. This way, you can easily restore access to the deleted branch's content without losing any of the commit history.

What is the reflog process to restore a deleted branch in git?

To restore a deleted branch in git using the reflog process, you can follow these steps:

  1. Use the git reflog command to display a list of recent actions that have been taken in the repository, including branch deletions.
  2. Find the commit hash of the commit where the branch was deleted. Look for an entry in the reflog that corresponds to the deletion of the branch.
  3. Once you have identified the commit hash, use the git checkout -b command to create a new branch at that commit. Replace with the name of the branch you want to restore and with the commit hash you found in step 2.
  4. You should now have successfully restored the deleted branch in git using the reflog process. You can now continue working on the branch as needed.

How to retrieve a deleted branch in git with reflog syntax?

To retrieve a deleted branch in git using reflog syntax, you can follow these steps:

  1. Find the commit where the branch was deleted by running the following command:

git reflog

  1. Look for the entry corresponding to the deletion of the branch. It will typically have a message like "branch: Created from HEAD" followed by the commit hash.
  2. Copy the commit hash associated with the deletion of the branch.
  3. Checkout the commit using the commit hash by running the following command:

git checkout -b

Replace <branch-name> with the name of the branch you want to recover and <commit-hash> with the commit hash you copied in step 3.

  1. Your deleted branch should now be restored. You can verify it by running:

git branch

That's it! You have successfully retrieved a deleted branch in git using reflog syntax.

How to access a deleted branch in git?

If you have deleted a branch in Git and want to access it again, you can use the following steps:

  1. Use the "git reflog" command to see a log of all the recent actions that have been performed in your repository, including the deletion of branches. This will show you the commit ID of the deleted branch.
  2. Identify the commit ID of the deleted branch in the reflog output.
  3. Use the "git checkout -b " command to create a new branch at the commit ID of the deleted branch. Replace with the name you want to give to the new branch.
  4. You should now have a new branch that is based on the commit ID of the deleted branch, allowing you to access the contents of that branch.

Alternatively, you can also use the "git fsck --no-reflogs" command to find the commit ID of the deleted branch and then create a new branch at that commit using the "git checkout -b <branch_name> <commit_id>" command as mentioned above.

How to re-create a deleted branch in git?

To re-create a deleted branch in Git, you can use the following steps:

  1. Identify the commit hash where the branch was deleted by using the git reflog command.
  2. Checkout the commit before the delete operation by using the hash obtained in the previous step: git checkout
  3. Create a new branch from that commit: git checkout -b
  4. Push the newly created branch to the remote repository: git push origin

These steps will help you re-create a deleted branch in Git.