Gitweb- Deleted branch is not listed in the web interface

183 views Asked by At

Is there any way to list the deleted branch in gitweb interface?

I just created a new branch in git and the same is reflected in gitweb interface but when I delete the branch it is no listed in gitweb interface, Ideally it should listed in gitweb interface with a message Branch deleted

Please let me know if its possible !

2

There are 2 answers

0
functionpointer On BEST ANSWER

In Git, Branches are Pointers to Commits. Every commit points to its parent(s). So, there are only two ways to make commits visible:

  • Make a Branch (or Tag) point at the commit
  • Make a Branch (or Tag) point at an descendant of the commit

As Branches itself are only pointers, they are not commited and therefore not versioned. If you delete a Branch, it is lost forever, without any notice from anything (apart from reflog). That doesn't mean you lost something, because it is only a pointer after all. You can still use git reflog to get the commit's SHA back. Then you can create a new branch pointing at that commit.

To answer your question:

No, as branches are not versioned you will not get a branch deleted message in gitweb.

The only way to make the "deleted" commits visible is, to use one of the above mentioned ways to make a commit visible (or reachable). Maybe you can create a branch deleted_branch?

0
Stefan Fleiter On

It is quite common to create short lived branches with git and delete them after their content is merged or rebased to keep track of the branches and their purpose. If you really need to see your deleted branches in the web interface you should not delete but rename them

git branch -m [<oldbranch>] <newbranch>

If you delete a branch by accident and do not have the reflog for whatever reason you can find commits not referenced by any branch with

git fsck --full

See the Pro Git recovery chapter for details.