Reputation: 6836
Assuming I have branches o1
o2
o3
o4
.
They all have multiple commits where all commits in o1
were made before o2
which were made before o3
, etc...
I want to create a branch d1
which contains all commits from o1
, o2
, o3
and o4
intact. I.e. same hash identifier. You can assume that they do not conflict with each other.
The main purpose is that if they become merged to somewhere else in the project, no duplicate commits are detected (2 different commits with the same changes).
I'm puzzled trying to do this because git merge
removes the branch after merging and it is the only thing I was able to think of and cherry-pick (if I understood right), doesn't seem to be a proper option.
Upvotes: 1
Views: 750
Reputation: 530843
The only way you can create d1
without modifying the hashes is if you already have history that looks something like this:
* -- * -- * -- * -- * -- * -- * -- * -- * -- * -- *
o1 o2 o3 o4
That is, if everything you can reach from o1
is also reachable from o2
, etc. Otherwise, creating your branch d1
will involve creating at least one new commit from an old one, with the new one having a different parent. The parent of a commit contributes to its hash, so what you want is not possible.
Upvotes: 1