[英]How do I ignore everything except a couple files in the top-level directory and everything in a few directories with .gitignore
[英]How can I ignore everything except two directories (nested)?
這是我安裝了 git 的根目錄:
htdocs/
.git
xampp
test
myweb
myweb_dependencies
onOtherProject
php_info.php
.gitignore
這里也是.gitignore
的內容:
# Ignore everything
*
# But not these files
!myweb
!myweb_dependencies
我想要做的是忽略除這兩個目錄之外的所有內容: myweb
和myweb_dependencies
。
問題是:顯然.gitignore
的內容是錯誤的,因為它沒有跟蹤對myweb
目錄的更改。 我該如何解決?
應該是這樣的:
# Ignore everything
/*
/*/
# But not these files
!/myweb/
!/myweb_dependencies/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.