Git Subtree Commit and Push

Viewed 115

Assume the following typical subtree configuration:

  • A is a local repo and have a typical commit history.
  • Folder B is subtree under A.
  • Folder B is a clone of C, and C is my personal repo at upstream (e.g. at Github).
  • I have forked C from D, and D is not my personal repo.

If I have some modifications to B and want to update C, what I generally do is:

  1. Do conventional commit to A.
  2. 'git subtree push' from local B to upstream C.

When I do this the first time (i.e. after the initial setup of B), upstream C gets all the commit history from A, even if I use the --squash during the git subtree push. But it does not happen after the first push.

Is this normal behavior? How can I prevent C to have all the unnecessary commit history of A?

I am guessing that this is because C is my personal repo. If I request from the owner of D to pull C, probably he/she can do a pull with a squash to ignore all the unnecessary commit history of A.

0 Answers
Related