

I would be cautious everywhere about that! Again, at least from my experience, a “branch” mostly never is considered as a pointer but more as a “collection” of commits that originate from a certain point in another branch. I’ve read it countless times, and that seems to match how Git behaves: git branch -d branchname, for instance, simply deletes the branch pointer branchname which points to the commit at the tip of the branch, but that commit and its ancestors are still present in the repository, and accessible through their hash, e.g. In my experience of GitLab, deleting a branch through the web interface deletes the branch in the Git sense, that is to say the branch pointer, not the commits.Īctually, I’ve never considered a branch as just a pointer to a commit, but that might as well be true (I am not a Git wizard 😉 ). That is not the case on GitLab, which I was using previously. I also believe that with “Delete this branch” GitHub does mean “Delete this branch’s commits”. I meant my repository’s network graph, shown in the Insights tab of the repository on GitHub. What history view do you mean by “My history”? Is this behavior a bug or a feature of GitHub? If it is a feature, where else should I be cautious that the term “branch” is used to mean “the branch’s commits”? Or am I simply wrong in my understanding of what a branch means in Git?īeta Was this translation helpful? Give wrote: Unreacheable commits, granted, but still present, and accessible through their hash.

I expected, and kinda wanted, to only delete this pointer, the branch’s name, leaving out the commits: The repository’s graph, in Insights > Network on GitHub, now looks like that:Ī branch, in Git, is a pointer to a commit, or so I’ve read countless times. I then deleted the feature branch by clicking on the button that says so in the pull request, and was surprised to find out from the repository’s graph that the branch’s commits, not just the branch’s name, had been deleted. Hi, I’ve accepted a pull request on GitHub through a squash and merge of the feature branch into the master branch:
