I have "shallowed" a repo:
FIRST_COMMIT="bf450342272a94117d78eae34a140a2a39359dad"
git rev-parse ${FIRST_COMMIT} > .git/shallow
git fsck --unreachable
git gc --prune=now
Now I try to push:
! [remote rejected] develop -> develop (shallow update not allowed)
I understand that this limitation is due to the repo being shallow.
How can I convert a shallow repo to a normal repo?
I do not care about losing old history. Actually, I want to lose old history
To clarify this:
- I want the converted repo to keep the commit history, with metadata (date, author, commit message, ...) of the shallow repo
- I want to completely lose the old history
- I do not care about compatibility with the original repo: this is to be considered a new repo
- I do not care if the commits are recreated, just that the metadata is kept.
EDIT
Simply removing the .git/shallow
file does not work:
» git push -f --set-upstream myorigin develop
error: Could not read d18d4a247bebd32a3b57b2c0e5f9c28749083211
fatal: revision walk setup failed
error: remote unpack failed: eof before pack header was fully read
error: failed to push some refs to 'git@somehost:repos/somerepo.git'
EDIT2
Trying to unshallow with fetch
:
git fetch --unshallow
Still leaves a grafted
repo:
commit bf450342272a94117d78eae34a140a2a39359dad (grafted)
Author: The author
Date: Thu Nov 29 16:55:05 2018 +0100
Chages by pre-commit hook (!?)
git fetch --unshallow
– Largofetch
from where? there is no remote to fetch from. The repo is local for the time being. That is, I am trying to push to a new remote, which has no history, and from where I have not cloned. What doesfetch
mean in that context? – Siegfried[remote rejected]
, so presumably there is a remote repo? So where are you trying to push to? – Largogit reset --soft develop/master
be sure to immediately commit all your files and push all your files. If you need to recover your history you should be able to soft reset again with a commit hash fromgit reflog
– Largo