Git subtree not properly using .gitignore when doing a partial clone

Posted by D W on Stack Overflow See other posts from Stack Overflow or by D W
Published on 2010-03-23T21:37:27Z Indexed on 2010/03/24 0:13 UTC
Read the original article Hit count: 783

Filed under:

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.

There is an example that is along the lines of what I'm trying to do at:

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.

[email protected]:~/research/trunk$ ls * -r
biblography.bib  JabRef

src: README~ script4.R~  script5.awk~ 

cfgFile1.ini~  cfgFile2.ini~  cfgFile3.ini~

bigBinaryPackage1   bigBinaryPackage2

[email protected]:~/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?

© Stack Overflow or respective owner

Related posts about git

Related posts about subtree