tags:

views:

73

answers:

3

I am trying to sync my desktop and laptop using a cron'd git. It works beautifully on a single directory. However I want to sync multiple config files scattered about and some other things. To do this decided to turn my home folder into a git directory and ignore everything except for a few select files and directories.

$ cat .gitignore
*
# test is a directory
!test

Does not work. Looking at another stackoverflow question, I found */ and used it instead of *. That almost worked as I wanted it to, but then all of the random single hidden files I have scattered about my home directory showed up.

A: 

Try:

!test/*

instead. I'm not sure if this will work (wild guess), but it is worth a try.

Stargazer712
+2  A: 

From my git ignore in my home directory.

*

Then you have to git add -f stuff you want to commit. Least that is how I do it for my configs.

docgnome
This would work for single config files. But for instance, I want to sync my entire documents folder. So part of the script runs `git add .` to pick up any new files that are created.
Fletcher Moore
so make it `git add -f my_docs_dir/*`
docgnome
A: 
$ cat .gitignore
**/*
*
# test is a directory
!test
Justice