dylasd 发表于 2015-02-05 15:29

git如何跟踪字符文件

由于某种原因,我需要使用git跟踪根文件系统,根文件系统里有自己mknod的字符设备文件
但是我发现使用git根本无法跟踪这种文件,请教大家这是为什么,怎么才能跟踪呢?

以下是我自己做的实验:
root@System:/work# mkdir test
root@System:/work# cd test/
root@System:/work/test# git init .
Initialized empty Git repository in /work/dongyulong/test/.git/
root@System:/work/test# mknod char_dev c 1 2
root@System:/work/test# ll
总用量 12
drwxr-xr-x3 root root 40962月5 15:25 ./
drwxr-xr-x 12 root root 40962月5 15:25 ../
crw-r--r--1 root root 1, 22月5 15:25 char_dev
drwxr-xr-x7 root root 40962月5 15:25 .git/
root@System:/work/test# git st
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
root@System:/work/test#

dylasd 发表于 2015-02-05 17:28

没人帮我啊 大牛们 帮忙分析一下吧:'(:'(:'(:'(

Tinnal 发表于 2015-02-05 19:41

回复 2# dylasd


    git add呀。

dylasd 发表于 2015-02-06 08:29

回复 3# Tinnal

add不进去,早就试过了


   

Tinnal 发表于 2015-02-06 21:02

回复 4# dylasd


   
恩,查了一下,确定加不进去。git只加目录、常规文件、符号文件。

No, Git will not track device files at all (currently). Here's a comment from dir.c, read_directory_recursive (v1.7.8.5) function which is used when you do git add .:

* 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.
Git tracks contents, not files. So trying to make it track device files doesn't really fit - they don't really have content in a traditional sense.

An approach that would work is to create a script that creates/"installs" the device files your application/project needs (including fifos or whatever else you might need). Git can track that very effectively, and it's a handy form to have that in for an installer (or for other people using your tree).


http://superuser.com/questions/440873/git-unable-add-device-file

dylasd 发表于 2015-02-07 14:07

回复 5# Tinnal

感谢帮助,曲线救国了,每次打包rootfs的时候用shell脚本mknod
   
页: [1]
查看完整版本: git如何跟踪字符文件