Git subtree not properly using .gitignore when doing a partial clone
- by D W
I am a graduate student with many scripts, bibliography data in bibtex, thesis draft in latex, presentations in open office, posters in scribus, and figures and result data. I would like to put everything in one project under version control. Then when I need to work on a portion such as the bibliography data, I would like to check that subdirectory out, modify it as necessary and merge it back.I would like the ability to check out one version to my home computer, and a different one to my work computer and make changes to each independently and eventually merge them back. I would also like to be able to check out a piece of code from this big project and import it with versioning into a separate project. If I may changes I'd like to be able to merge them back to the original project.
Based on my understanding git subtree can do this.
http://github.com/apenwarr/git-subtree
There is an example that is along the lines of what I'm trying to do at:
http://psionides.jogger.pl/2010/02/04/sharing-code-between-projects-with-git-subtree/
Say the trunk of my project contained the directories: (bib bin cfg data fig src todo).
When I use
git subtree split -P bib -b export
git checkout export
I get a the bib directory, plus all files that should have been ignored or considered binary based on .gitignore such as the src directory and everything in it that ends in a tilde or the ./data directory.
dwickrama@DWwork:~/research/trunk$ ls * -r
biblography.bib JabRef
src:
script1.sh~ README~ script2.sh~
script3.sh~ script4.R~ script5.awk~
script5.py~
cfg:
cfgFile1.ini~ cfgFile2.ini~ cfgFile3.ini~
bin:
bigBinaryPackage1 bigBinaryPackage2
dwickrama@DWwork:~/research/trunk$
My .gitignore file is as follows:
*.doc diff=word
*.tex diff=tex
*.bib diff=bibtex
*.py diff=python
*.eps binary
*.jpg binary
*.png binary
./bin/* binary
*~
How do I prevent this?