Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

For example:

git clone
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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .