这是我继承的 Ruby on Rails 应用程序内目录的各自大小:
→ find . -maxdepth 1 -type d -mindepth 1 -exec du -hs {} \;
263M ./.git
2.0M ./app
124K ./config
728K ./db
4.0K ./doc
56K ./lib
0B ./log
232K ./public
8.0K ./script
164K ./spec
560K ./spreadsheets
16K ./test
64K ./vendor
我在 GitHub 上的现有存储库分支上创建了一个新存储库,并完好无损地保留了旧存储库。 我不需要新存储库中的任何历史记录,因为旧存储库的特定分支成为新存储库的主分支,并且这是新存储库中的唯一分支。
我希望将文件夹 .git 的大小设置为最小大小,因为这在 GitHub 空间、本地空间和 Heroku 部署方面绝对是浪费。
Git init 不起作用。我不知道我是否可以
rm -rf .git
然后重新初始化Git存储库,然后将其推送到GitHub远程。
执行以下命令:
# remove old content
rm -rf .git
# init new repo
git init
# add all current files (add .gitignore entries if you need to ignore some files)
git add -A .
# commit the current content
git commit - m ".. Message..."
# add the remote url of the github server
git remote add origin <github new url>
# oush your code to github
git push origin master