Possible Duplicate:
How to purge a huge file from commits history in Git?
我做了一件 st事。 Imagine说,我投了100MB卷宗。 之后,我看到这一点,删除这一档案并再次作出承诺。 这是删除档案的正常程序。
但现在的副作用是,我的历史是沉重的,因为它拯救了这个庞大的档案(我认为这是为什么如此沉重)。 我只使用当地电梯,因此我不协调任何服务器。
我怎样才能最终消除这一档案,节省磁盘空间?
Possible Duplicate:
How to purge a huge file from commits history in Git?
我做了一件 st事。 Imagine说,我投了100MB卷宗。 之后,我看到这一点,删除这一档案并再次作出承诺。 这是删除档案的正常程序。
但现在的副作用是,我的历史是沉重的,因为它拯救了这个庞大的档案(我认为这是为什么如此沉重)。 我只使用当地电梯,因此我不协调任何服务器。
我怎样才能最终消除这一档案,节省磁盘空间?
您可使用<代码>过滤器-branch。 指挥:
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
You can find more documentation here http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository
您的指令是filter-branch
。 这使你能够永远从招募中删除档案。 这一博客就如何从存放处删除有问题的档案拥有很大的指导。
您可在David Underhill上拿这一伟大文字,将档案从盖特存放处删除:
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository s root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
fi
# make sure we re at the root of git repo
if [ ! -d .git ]; then
echo "Error: must run this script from the root of a git repository"
exit 1
fi
# remove all paths passed as arguments from the history of the repo
files=$@
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...
I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...
I have a svn repo with various apps as subdirectory of a single svn repo. That worked because I could have checked out a partial, repo. As I cant do that with git obviously I need multiple repos. I ...
I understand how to merge branches together in git, and I love how easy it makes it. I have a branch that looks like this: project/ |--subproj1/ | |---(files) | |--subproj2/ |---(files) A ...
We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...
I get this on every git svn command I try. I am using git version 1.6.4.2 on OS 10.6 The initial git svn fetch works, and i can do further fetches after that, but they do not enter the log or update ...
Given I have a master branch and a other branch. In the other branch are files I don t want to commit (e.g. log files) so I ignored them in .gitignore. When I switch to the master branch, these ...
Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...