Git上的Unversion

Ada*_*ite 4 git version-control commit bitbucket

我正在设计和构建一个iOS应用程序,它使用本地git存储库进行版本控制.到目前为止,我已经将所有内容都置于版本控制之下,包括大型文件夹,例如"设计",其中充满了我的Photoshop资源等等.我现在已经为repo添加了一个远程位置,显然不希望将Design文件夹提交到远程.

我用以下.gitignore文件制作了一个文件:

# File Extensions #
###################
*.psd

# Folders #
###########
/Design/*
Run Code Online (Sandbox Code Playgroud)

哪个应该排除该文件夹和任何Photoshop文档对吗?

如何解开现有设计文件夹(git rm实际上删除文件!)?此外,当我取消它时,它会自动缩小巨大的.git文件夹吗?

非常感谢.

One*_*One 12

使用git你可以使用git rm --cached design/,这将保留文件.

要从整个历史记录中删除它,您可以尝试以下方法:

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch design/' \
  --prune-empty --tag-name-filter cat -- --all

$ rm -rf .git/refs/original/

$ git reflog expire --expire=now --all

$ git gc --prune=now

$ git gc --aggressive --prune=now
Run Code Online (Sandbox Code Playgroud)

ref:https://help.github.com/articles/remove-sensitive-data