我遵循此http://help.github.com/remove-sensitive-data/
但仍然有一些文件很难删除,我只需要在git://github.com/visionmedia/express.git中保留/lib/request.js
/lib/response.js
,其他人都应该删除。
在那篇文章中,我需要告诉要删除哪个文件,例如Rakefile
git filter-branch --index-filter 'git rm --cached --ignore-unmatch Rakefile' --prune-empty -- --all
但我想要的是告诉保留哪个文件。
我该怎么做?
答案 0 :(得分:0)
您确定不应该创建一个全新的存储库,而只是从复制的两个文件开始吗?
$ mkdir my_repo
$ cd my_repo/
$ git init
Initialized empty Git repository in /Users/annelicuss/my_repo/.git/
$ wget https://raw.github.com/visionmedia/express/master/lib/request.js
--2012-05-13 20:38:08-- https://raw.github.com/visionmedia/express/master/lib/request.js
Resolving raw.github.com... 207.97.227.243
Connecting to raw.github.com|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8878 (8.7K) [text/plain]
Saving to: `request.js'
100%[======================================>] 8,878 --.-K/s in 0s
2012-05-13 20:38:10 (242 MB/s) - `request.js' saved [8878/8878]
$ wget https://raw.github.com/visionmedia/express/master/lib/response.js
--2012-05-13 20:38:16-- https://raw.github.com/visionmedia/express/master/lib/response.js
Resolving raw.github.com... 207.97.227.243
Connecting to raw.github.com|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15276 (15K) [text/plain]
Saving to: `response.js'
100%[=======================================================================================================>] 15,276 --.-K/s in 0s
2012-05-13 20:38:17 (280 MB/s) - `response.js' saved [15276/15276]
$ ls
request.js response.js
$ git add *
$ git commit -m 'Add request, response from Express.'
[master (root-commit) be4a6d9] Add request, response from Express.
2 files changed, 1059 insertions(+), 0 deletions(-)
create mode 100644 request.js
create mode 100644 response.js
$ git log
commit be4a6d9c82cb48b61f662e1e83a9f696a6685883
Author: Arlen Cuss <a@unnali.com>
Date: Sun May 13 20:38:37 2012 +1000
Add request, response from Express.
$
请注意,即使这可能也不会做你想要的; request.js
和response.js
都依赖于,例如util.js
位于同一目录中。您可能只想将Express添加为项目的依赖项。