嵌套 Git 忽略,Git Kraken 将忽略的文件列为未暂存文件
Nested Git Ignore ,Git Kraken Lists Ignored files as unstaged files
我想将我的文件夹结构置于版本控制之下。
我想要这样做的方法是添加嵌套的 .gitignore 文件,如下所示:
(请注意,我添加了一些垃圾 *.txt 文件以检查 git忽略是否正常工作)
└── storage
├── .gitignore
├── public
│ ├── .gitignore
│ ├── logo
│ │ ├── .gitignore
│ │ └── logo.txt
│ └── public.txt
└── storage.txt
存储/.git忽略是:
*
!/public/
!.gitignore
storage/public/.git忽略是:
*
!/logo/
!.gitignore
storage/public/logo/.git忽略是:
*
!.gitignore
一切似乎都正常我的 *.txt 文件被忽略和未跟踪,这是预期的目的。
问题是 Git Kraken GUI 将 logo.txt
和 public.txt
显示为未暂存文件,就像任何其他未忽略的文件一样,但 storage.txt
不存在!
git status
nothing to commit, working tree clean
git status --ignored
storage/public/logo/logo.txt
storage/public/public.txt
storage/storage.txt
nothing to commit, working tree clean
我用另一个 git GUI (ungit) 进行了测试,结果与 git cmd 相同。
所以问题是什么?是某种 git Kraken 错误吗?或者我遗漏了一些关于 gitignore rules?
的内容
(注意:这个虚拟项目是新鲜的,并在两台不同的计算机上进行了测试)
Note: GitKraken will only look at the .gitignore located at the root
of your repo directory. Nested .gitignore files are not parsed.
所以它是 GitKraken 的 "feature"。
我想将我的文件夹结构置于版本控制之下。
我想要这样做的方法是添加嵌套的 .gitignore 文件,如下所示:
(请注意,我添加了一些垃圾 *.txt 文件以检查 git忽略是否正常工作)
└── storage
├── .gitignore
├── public
│ ├── .gitignore
│ ├── logo
│ │ ├── .gitignore
│ │ └── logo.txt
│ └── public.txt
└── storage.txt
存储/.git忽略是:
*
!/public/
!.gitignore
storage/public/.git忽略是:
*
!/logo/
!.gitignore
storage/public/logo/.git忽略是:
*
!.gitignore
一切似乎都正常我的 *.txt 文件被忽略和未跟踪,这是预期的目的。
问题是 Git Kraken GUI 将 logo.txt
和 public.txt
显示为未暂存文件,就像任何其他未忽略的文件一样,但 storage.txt
不存在!
git status
nothing to commit, working tree clean
git status --ignored
storage/public/logo/logo.txt
storage/public/public.txt
storage/storage.txt
nothing to commit, working tree clean
我用另一个 git GUI (ungit) 进行了测试,结果与 git cmd 相同。
所以问题是什么?是某种 git Kraken 错误吗?或者我遗漏了一些关于 gitignore rules?
的内容
(注意:这个虚拟项目是新鲜的,并在两台不同的计算机上进行了测试)
Note: GitKraken will only look at the .gitignore located at the root of your repo directory. Nested .gitignore files are not parsed.
所以它是 GitKraken 的 "feature"。