0

I would like to try to recover a deleted branch from a remote Atlassian Stash server.

I will explain the steps that I did, which brought me to this situation:

  • I initially created a new branch (using the command line) on my local computer (my local OS is Ubuntu 12.04 LTS) from the master branch.
  • I then did some work in that branch.
  • I then commited my changes to my local copy of the branch. I pushed the new branch to the remote server (I could see that the branch in the web interface of the Atlassian Stash server, so it definitely existed on the remote server)
  • I then deleted that branch from the server, using the graphical interface.
  • I (stupidly) also deleted the branch from my local computer, using -D option, which forced it deletion even though it had not been merged.

The branch was never merged into any other branch.

But now I realised that I need to get the branch again! (I thought that I had copied the directory to another location, but I had not).

I think that the files are really deleted from my local computer, I have tried to use some tools to recover them, but I cant find them, I dont think I can recover them by just using my local comptuer. I think my best bet is to try to get the branch that was pushed to the remote server (but is no longer visible).

My main question is: is it possible to recover a deleted branch from an Atlassian Stash server (a branch that was not merged into any other branch).

I am hoping that it still exists on the Atlassian Stash server, and that there is some way to get it from there.

Kara
  • 6,115
  • 16
  • 50
  • 57
user3441604
  • 582
  • 7
  • 23
  • Oh, it turns out I have a Gold badge for "Git", so my close-vote instantly closed your question as duplicate. So long as you didn't delete your working directory entirely, then the method in the linked question should solve your problem. – Oliver Charlesworth Jul 05 '14 at 11:52
  • @OliCharlesworth Funny thing is: it does not show up if I view your badges. Have you sold it? – Maarten Bodewes Jul 12 '14 at 18:13
  • @owlstead: Alas no. Turns out it was a Java gold badge that did it (question was originally tagged as Java). – Oliver Charlesworth Jul 12 '14 at 18:14
  • @OliCharlesworth Kind of funny; you first removed that tag and *then* closed it :) I guess that if the link does not resolve it to users satisfaction a more precise question can be formatted. – Maarten Bodewes Jul 12 '14 at 18:18
  • I'm not sure if this is a duplicate, since remote branches can not be tracked down in the local reflog as long as you don't happen to have a local reference to it. So in order for the other answer to work you have to track down the developer which still has or had local references to the remote branch. It's not clear to me how to access the remote atlassian stash reflog. There is no UI exposed for it. – David Ongaro Jan 21 '16 at 19:49

0 Answers0