The problem
From time to time, I have scripts and binaries that I only really need on one system. Since the base dotfiles repo includes a bin directory (for dfm itself), if I just drop files in there, git continually shows me that they are untracked. For instance, if I have a script called only_on_my_mac, then running dfm status shows:
1 2 3 4 5 6 | |
At the very least, this is annoying. Here, I offer three solutions to this problem.
Solution 1: .gitignore
The first solution is to just drop a .gitignore file in the bin directory and specify each file that needs to be ignored:
1
| |
If you only have a couple scripts, this may work. However, after the third entry, this gets rather tedious.
Solution 2: Create an excluded directory
This solution is a slight modification of the previous one. Instead of ignoring each individual file, create a directory for excluded scripts:
1
| |
Then, ignore all the files inside that directory (except the .gitignore file itself):
1 2 | |
Finally, update .bashrc.load to add the new directory to the path:
1
| |
Now, any scripts that are only for one system can just be dropped into the bin/excluded directory and git/dfm won’t try to track them.
Solution 3: Use dfm recursion
This solution involves modifying the .dfminstall file in the base of the dotfiles repository. Add the following line:
1
| |
Then, when dfm installs, it will symlink any scripts in the dotfiles’ bin directory instead of symlinking the entire directory.
1 2 | |
1 2 3 4 5 6 | |
This solution only started working today. There was an bug in dfm that prevented the bin directory itself from being recurse-able. If you want to use this solution, you’ll need to merge the latest code.
Conclusion
I personally use Solution #2, mostly because I don’t want to keep a list of files to ignore (translation: lazy).
I hope these solutions are helpful. Enjoy.