I have replaced the parent of my initial commit with the last commit of another repository. I'd like to push these changes.
What I did, gathering from 1 and 2:
git clone B
cd B
git remote add A URL
git fetch A
git replace --graft b_root_sha a_head_sha
git push origin 'refs/replace/*:refs/replace/*'
This worked fine and the refs were pushed. But I must have understood something wrong. I see no evidence of the replacement in the remote repo. My first commit is still b_root
and it has no parents. I'm viewing it on GitHub, if it makes any difference.
Ideally I would have wanted to:
- Push the commits in
A
to really precedeB
inmaster
- Have the commit hashes preserved because of references in closed issues and pull requests
Because then the whole history would be in the same repository. Is this combination possible? If not, can the whole history be pushed at the cost of references being destroyed, or at least the parent be shown in the repository? Or at the very least have the code in the repository somewhere just in store for people to fetch the references and see for themselves what the correct parent should be.