Recovering a git branch

0 votes
One of my teammates, accidentally deleted a branch and has already pushed the changes to central git repo. There are no other git repos and none of my teammates has a local copy. How to recover that branch?
Nov 26 in Git & GitHub by anonymous
• 6,650 points
16 views

1 answer to this question.

0 votes

Check out the latest commit to this branch in the reflog, and then check it out as a new branch.

  • Reflog is a mechanism to record when the tip of branches are updated. This command is to manage the information recorded in it. Basically every action you perform inside of Git where data is stored, you can find it inside of the reflog.

  • git reflog won't navigate HEAD's progressive system by any stretch of the imagination. The reflog speak to the requested rundown of the submits that HEAD has indicated: it's fixed history for our repo. 

  • The reflog isn't a piece of the repo itself (it's put away independently to the submits themselves) and is excluded in pushes, gets or clones; it's absolutely neighbourhood. you can't generally lose information from your repo once it's been dedicated. 

  • On the off chance that you incidentally reset to a more established submit, or rebase wrongly, or whatever other tasks that outwardly "evacuate" submit, you can utilize the reflog to see where you were previously and git reset - hard back to that ref to reestablish your past state

answered Nov 26 by Sirajul
• 40,980 points

Related Questions In Git & GitHub

0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,810 points
209 views
0 votes
2 answers

Delete a git branch locally and remotely

Deleting a remote branch: git push origin --delete ...READ MORE

answered Aug 20, 2018 in Git & GitHub by Nilesh
• 6,920 points
200 views
0 votes
1 answer
0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,310 points
80 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
245 views
0 votes
1 answer
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2 in Git & GitHub by Sirajul
• 40,980 points
96 views
0 votes
2 answers

What is git rebasing?

In Git, there are two main ways ...READ MORE

answered Aug 2 in Git & GitHub by Sirajul
• 40,980 points
161 views