This is forbidden.
A Git commit includes its parent hash ID(s). If you, as a sender, offer commit H (for some hash ID H) to another Git, that other Git need not accept H until it also has H's parent (or parents, if it is a merge commit). So you must offer H's parent(s). It need not accept that commit until it has that (or those) commit's parent(s) in turn, and so on.
To put it another way, the ID of a commit is its hash, but to have that commit in a repository implies that you also have all of its ancestors.1 Hence the only way to work with such a commit is to have all of its ancestors.
At that point, you can make a copy of that commit—e.g., via git cherry-pick
—to get a different commit with a different hash ID, different parent, and whatever other differences you might want as a result of this different parent.2 You can then deliver this different commit (by its different hash ID) to some other Git repository. If that other Git repository does have the parent of this new copy, they won't demand any additional commits first.
1This rule is relaxed in shallow clones, and there is ongoing work to relax it in other ways, but it's still at least required in principal. A commit that doesn't have its ancestry is at least suspicious; it could be a fake; the integrity of the chain is determined by following the chain all the way back to the root.
2In particular, you probably want a different snapshot as well. Remember that Git commits hold snapshots—a full copy of every file—rather than changesets. So if your copy H'
of commit H
is to be applied to commit B
, what you want in H'
is not the snapshot that is in H
, but rather the snapshot that results from changing H
into a changeset, then applying that changeset to commit B
, while taking into account any other differences between H
's parent and B
as well. To change H
into a changeset, we (or Git) will compare its snapshot to its parent's snapshot.
(The git cherry-pick
command is a tool for making H'
from H
-and-its-parent while having commit B
checked out.)