Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

is git unable to commit a device file? Under Linux system.

For example:

git clone blah@blah.com:/blah.git
cd blah 
sudo cp -af /dev/ttyS0 .
git add .
git commit

git msg:

# On branch master
nothing to commit (working directory clean)

ls -ashl result:

   0 crw-rw----  1 c2h2 c2h2 4, 64 Jun 24 14:23 ttyS0

Is it possible to do so?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.