我正在设计和构建一个 iOS 应用程序,它受本地 git 存储库的版本控制。到目前为止,我已经一切 都在版本控制下,包括像“Design”这样的大文件夹,里面装满了我的 Photoshop Assets 等。我现在已经向存储库添加了一个远程位置,显然不想将 Design 文件夹提交到远程位置。
我制作了一个包含以下内容的 .gitignore
文件:
# File Extensions #
###################
*.psd
# Folders #
###########
/Design/*
哪个应该排除该文件夹和任何 Photoshop 文档?
如何取消现有设计文件夹的版本(git rm
实际上会删除文件!)?另外,当我取消版本时,它会自动缩小巨大的 .git 文件夹吗?
非常感谢。
最佳答案
使用 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
关于git - Git 上的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13609279/