Deleting git branch loses audit

2019-05-21 08:44发布

问题:

If a branch has been deleted in git is it still possible to identify whether specific commits were made on that deleted branch?

From what I have found so far - git branches are merely pointers so deleting them would lose the that specific part of the audit history.

Hoping that I can be proven wrong on this.

thanks,

回答1:

git branches are merely pointers

Yes and which is exactly why deleting them would delete just the pointer.

If you have merged the branch to your mainline, you no longer need that pointer; but you will always know what all commits were made to that branch individually, unless you explicitly choose to not know the specific changes by asking for a fast-forward merge.



回答2:

The details of exactly which branch you made your commits to are lost once you merge back to another branch. This is detailed in this post and this.

You shouldn't delete branches which are long running and which you wish to keep track of. The act of deleting a branch is a statement of sorts saying that you don't care about that path but from that point on but just about the code.