I have a local git repository that I cloned with
git clone --depth 1 my_repo_url
so I will only have the last commit, and you don’t have to worry about keeping a big story around.
If I now execute the git tag, now I can get, say, two more entries from the remote repo. What I want to do is update my repo to only support the latest commits again, NOT the rest of the story. However, I DO NOT want to use squashing / rebasing, as this will actually change my local history and lead to conflicts when I try to pull it again from a remote server.
Basically, if I have a commit history:
commit1 → commit2 → commit3 → commit4
I want to save only the repo snapshot at commit4 point.
But I don’t want to crush all these commits, because then I will stay with commit4 *, which will have a different hash from the original commit4 and therefore will cause conflicts when I try to extract from the source again.
I also do not want to use the git clone again, since this will not use the fact that I may need to send a little diff over the network if something very little has changed in the last commit to the remote server.
source
share