untraked file 未跟蹤的文件,通常為新建立的文件
traked file 通常為建立索引之后的文件
ignored 被忽略的文件,這類型的文件通常在一個文件列表中。維護這個列表的文件在版本庫根目錄名字為 .gitignore
初始化版本庫,保證剛創(chuàng)建狀態(tài)
1
2
3
4
5
6
7
8
9
10
11
|
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ ls hello huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ ls -a ./ ../ .git/ hello huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ rm -rf .git/ hello huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo $ git init Initialized empty Git repository in C:/Users/huawei/Desktop/git-repo/.git/ |
創(chuàng)建文件查看文件類型,發(fā)現(xiàn)為untraked file未被跟蹤的文件
1
2
3
4
5
6
7
8
9
10
|
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ echo "hello world" > hello huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ git status On branch master No commits yet Untracked files: (use "git add < file >..." to include in what will be committed) hello nothing added to commit but untracked files present (use "git add" to track) |
被跟蹤的文件通常為建立索引之后的文件,可以通過git ls-files -s查看。至于被忽略的文件可以看下面的演示,將文件名寫入到.gitignore文件即可
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ git status On branch master nothing to commit, working tree clean huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ echo "a" > a huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ git status On branch master Untracked files: (use "git add < file >..." to include in what will be committed) a nothing added to commit but untracked files present (use "git add" to track) huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ echo a >> .gitignore huawei@DESKTOP-JTC012C MINGW64 ~/Desktop/git-repo (master) $ git status On branch master Untracked files: (use "git add < file >..." to include in what will be committed) .gitignore nothing added to commit but untracked files present (use "git add" to track) |
.gitignore文件語法
#開頭的行用于注釋
空行會被注釋
目錄名末尾用反斜線(/)標記
包含shell通配符,如*。例 debug/32bit/*.o
起始地感嘆號用于取反模式
原文鏈接:http://blog.csdn.net/qq_34677946/article/details/78834246