本文介绍了如何在提交后删除本地git历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从Dropbox切换到开源Sparkleshare。它使用git进行同步和版本控制。如果说我有一个1GB文件,我在我的文件夹中删除,它保持在本地.git文件夹的历史记录。但是我想在服务器上而不是客户端上拥有这种大量数据。
如何提交我的仓库并使用git删除本地仓库?
非常感谢!
I would like to switch from Dropbox to the open source Sparkleshare. It uses git for the syncing and versioning. If say I had a 1GB file I deleted in my folder, it stays within the history of the local .git folder. But I would like to have this kind of heavy data on the server and not the client.How can I commit my repository and delete the local one with git?Many thanks!
推荐答案
解决方案删除记录
Solution removing the history
-
git fetch --depth = 1
来修剪旧的提交。这使得旧的提交及其对象无法访问。 -
git reflog expire --expire -reachable = now --all
。过期所有旧的提交及其对象 -
git gc --aggressive --prune = all
删除旧对象 >
git fetch --depth=1
to prune the old commits. This makes the old commits and their objects unreachable.git reflog expire --expire-unreachable=now --all
. To expire all old commits and their objectsgit gc --aggressive --prune=all
to remove the old objects
特定解决方案仅用于删除本地历史记录中的大文件
- GitHub提供的,它将大型文件始终存储在服务器上并提取他们只在结帐。非常容易设置和使用 - 如果您的存储库位于GitHub,bitbucket或gitlab上。
- - 允许在任何地方存储大文件
- GitHub offer's Git Large File Storage, which stores large files always on the server and fetches them only on checkouts. Very easy to setup and use - in case your repository is on GitHub, bitbucket, or gitlab.
- git-annex - allows storing big files anywhere
Specific solution just to remove the large file in the local history
讨论:
这篇关于如何在提交后删除本地git历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!