Situation:
There is a branch of the finished feature.
After merge into the general branch develop, I delete the feature line.

But its commits are still visible in the story:
commit tree

How can they be removed or hidden?

  • Merge is just to add commits from one branch to another. - MAXOPKA
  • one
    Why delete them, if they form the current story? - etki
  • A branch is just a label, it has a very consensual relation to commits, so it can be deleted. You cannot delete commits even if there are some methods to do this. - ixSci
  • The point of deletion is to save only the final results of work in 1 commit, and not to spray them on several. So I understood the methodology of working with the GitFlow feature branch - Skif
  • 3
    @Skif you misunderstood GitFlow - Pavel Mayorov

1 answer 1

Each commit contains (as an integral part) a link to the “parent” commit (merge commits contain more than one link to “parents”). The “parent” commit, in turn, contains a link to its “parent”, and so on. so a coherent change history is built.

if you delete any commit, the “connection of times” will be broken - because its “descendant” does not contain a reference to the “grandfather”.

to restore connectivity without rewriting history is impossible. and if you decide to rewrite, then be prepared for the pitfalls .

  • I put the question is not entirely correct. - Skif
  • Perhaps it would be more correct to: - can we see the general branch develop - Skif
  • Is it possible to see the general branch develop - without the features branches poured into it? So that only the merge-commit can be seen from the feature line with the final result. - Skif
  • in git, a branch is just a floating pointer to a commit, and not a set of commits, like, for example, svn or mercurial. those. Your new question comes down to rewriting history. the answer is yes, it is possible. and how - repeatedly stated (including on this site) - for example, using rebase. - aleksandr barakin