我运行此git add --force /dev/
cmd将/ dev设备添加到我的仓库中,我得到与之前相同的git-status
。我独立地在文件夹中添加每个文件,但我获得了相同的git-status。
这是我的测试,我得到相同的结果,可以git跟踪块和char设备吗?
yangchar@yangchar:~/verify$ git add ttyS0 --force
yangchar@yangchar:~/verify$ ll
-rw-r--r-- 1 yangchar yangchar 71 2012-11-28 10:59 hello.c
-rw-r--r-- 1 yangchar yangchar 0 2012-11-28 11:04 new.c
drwxr-xr-x 4 yangchar yangchar 4096 2012-11-28 11:15 ooxx/
-rw-r--r-- 1 yangchar yangchar 31 2012-11-28 10:47 README.md
crw-r----- 1 yangchar yangchar 4, 64 2012-11-28 16:05 ttyS0
yangchar@yangchar:~/verify$ git st
# On branch master
nothing to commit (working directory clean)
答案 0 :(得分:4)
不,您无法将设备文件添加到git存储库。以下是来自git dir.c的评论:
/*
* Read a directory tree. We currently ignore anything but
* directories, regular files and symlinks. That's because git
* doesn't handle them at all yet. Maybe that will change some
* day.
*
* Also, we ignore the name ".git" (even if it is not a directory).
* That likely will not change.
*/
Linux中的设备文件是一种特殊的文件,是什么让他们的内容跟踪非常困难(不可能?)。