zephel
zephel

Reputation: 185

Should sub-repo commits be cleaned from the parent repo commit history?

I am new to using git subtree. I get all the basics, including keeping super and sub-project code organized in separate commits.

However, is it best practice to keep the sub-project commits as part of parent's repository commit history?

If a commit only contains changes to sub-project code, why should it stay as part of the parent history?

If it shouldn't, what would be the best way to clean them from the log?

Upvotes: 2

Views: 63

Answers (1)

vakio
vakio

Reputation: 3177

The subproject is part of the parent project, so you cannot remove it from the history. But when you update the parent with updates of the subproject, the common practice is to not store the entire history of the subproject in your main repository. You usually use --squash. But you cannot get away from having that one commit in your history as it is essentially a part of the parent.

Maybe this tutorial will help https://www.atlassian.com/git/tutorials/git-subtree

Upvotes: 1

Related Questions