I am absolutely new to git and got completely lost. I am sure I miss something basic.
The problem is as follows:
- I committed and pushed large files (~2Gb) to a repository. Then I removed them - committed - pushed, but they are still in the history. I need to shrink the repository somehow.
- First, I followed how to shrink a git repository. I could only shrink the local version, but when I tried to push, it said that I have to pull first. Pulling, however, would bring the big history files back.
Similar to revert multiple git commits, I removed completely the last two commits by doing twice
git reset --hard HEAD^ git push -f origin master
Now, I can not see the last two commits in git log, but the repository/history is still big.
- As the files are not in the history anymore, I can not remove deleted files from git history, as git does not see them.
Say, I am the only user of the repository and the history of no value, I just need to shrink the repository somehow. However, I can only perform changes locally and then push them to the repository, hence, fully deleting the repository will not work, as
rm -rf .git
removes git and I won't be able to push.
How bad was doing 3? What can I do to achieve my overall goal? I would appreciate any suggestions. Many thanks in advance.