I know that if I want to forcibly overwrite a local repo with files from a remote repo, I do this:
git fetch --all
git reset --hard origin/master
The problem with this is that when I go to look at the history of the local repo, it has completely obliterated the history and replaced it with a carbon copy of the history of the remote repo.
Is there a way I can do this forcible overwrite while still preserving the history?
For example, if I have a file in the local repo with the following content:
- ContentA
- ContentB
- ContentC
And I have the same file in the remote repo with the following content:
- ContentA
- ContentC
- ContentD
After the pull from the remote repo, I want the history to show this for the file:
Version #1
- ContentA
- ContentB
- ContentC
Version #2
- ContentA
- ContentC
- ContentD
I don't want it to show this (from a forcible overwrite):
Version #1
- ContentA
- ContentC
- ContentD
Nor do I want it to show this (from a merge):
Version #1
- ContentA
- ContentB
- ContentC
Version #2
- ContentA
- ContentB
- ContentC
- ContentD
Is this possible?
