B
B
bormor2016-10-14 12:28:37
git
bormor, 2016-10-14 12:28:37

git flow. How to remove commits after deleting a branch?

Situation:
Working with git flow
There is a branch of a finished feature.
After merge into the common develop branch, I delete the feature branch.
But her commits are still visible in the history:
122c7c1daafa41bea4192cb74784a2e4.png
How can I hide or delete them? So as not to clog the repository.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2016-10-14
@Nipheris

Of course, the commits will be visible, when merging, a new merge commit is simply created, "linking" the two branches, and this commit is placed in the branch into which you are merging.
In general, what you have on the screen is a normal situation. If a person only wants the commits in the master, then their tool should only allow them to look at them. So it's not a problem of having commits, it's a problem of where you look at them.
If you really think that some commits are "extra" and could be merged, read about git squash. Only it is desirable to do this before pushing the branch, and certainly before the merge - now the merge commit is tightly attached to the last commit from the feature branch.
In general, read more about Git and about your UI to it, removing commits from the middle of a merged branch from the point of view of Git is an absolutely crazy idea. In particular, read up on what branches are: they're just moving pointers to a commit, and deleting a branch only removes commits if they haven't been merged anywhere. After the merge, deleting a branch is just deleting a pointer, which, as it were, tells us that the development of this branch is over, and there will be no further commits within this branch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question