0

I would like to list all branches, even those what already removed in a remote (origin). The main point that I would like to see event the removed ones

It would be OK just to see branch the names, but ideally the creation date and some other metainfo would be great like user name who created the branch.

I've found many related Q and A but neither lists the already removed branches. I am a newbie in git, so I do not know even is this possible, but I hope.

g.pickardou
  • 32,346
  • 36
  • 123
  • 268
  • 3
    You can't see removed branches, you've removed them.... – Liam Jan 30 '18 at 10:43
  • 1
    GIT branches don't contain "meta data". [They're lightweight pointers on the graph](https://stackoverflow.com/a/24940131/542251). The only way to find when they are created is to view the graph but even then they can simply be moved to a totally different part of the graph. Basically your not really understanding what a branch is. If you want to add meta data into the graph I'd suggest you use tags – Liam Jan 30 '18 at 10:45
  • @Liam, thanks for the comment. This is not a duplicate because the main point is I want to see the removed ones, and that duplicate you are referencing is about datetime. The answer would be your first comment, please post it as an answer. Btw, I am sad. – g.pickardou Jan 30 '18 at 11:08

1 Answers1

2

GIT branches are just lightweight pointers on a graph. They don't "contain" anything, they just point to a commit (a commit hash to be precise). There is nothing to stop you just moving (reset) a branch to any point on the graph. So the idea of meta data doesn't make sense. Think of a branch as a label and a commit hash and that's it.

When a branch is deleted, it's deleted. There is no getting it back. All the commit's still exist but the label and hash are no longer stored in the file system. You can recover deleted branches. This is only in the sense that you can add a new pointer to any disconnected commits though. The original branch is still deleted, your just replacing it with a new branch that happens to have the same name.

If you want to add meta data to a GIT repo then I'd suggets you use tags. You can then add meta data at certain points in the graph: enter image description here

So above you can see I've added tags (blue) that show when certain builds happened. So you could add a tag everytime you create a branch and where that branch was created, who created it, etc.

Liam
  • 27,717
  • 28
  • 128
  • 190