I used to have one folder per repository and push to gitlab. Later I wanted to group all these codes into a folder (Wrapper). I have remove the .git in each of these folders
-Wrapper // git initiated
-Project1 // .git removed
-Project2 // .git removed
The problem was it pushed the following directories
teams/*
dist/*
node_modules/*
temp/*
lib/*
I have rectified the problem with these commands
git rm -r --cached .
git add .
git commit -m "Untracked files issue resolved to fix .gitignore"
and added a .gitignore file in the Wrapper root folder. The repository still says 80MB.
I have attempted the following
git filter-branch --tree-filter "rm -rf node_modules" --prune-empty HEAD
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
git push origin --force --tags
and tried this
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch *node_modules*' \
--prune-empty --tag-name-filter cat -- --all
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
git push origin --force --tags
My repository is still 80MB. There is an option, which is to create a new project, create a new folder, put all projects in the folder, git init ... and git push will solve it, but is there chance I can keep my git history?
I checked my git log using this command,
git log --name-status >1.log
and it shows my history in adding the node_modules were removed.
$ git count-objects -vH
count: 0
size: 0 bytes
in-pack: 431
packs: 1
size-pack: 1.48 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes