1

I used Subversion for many years. It allowed you to do something very cool:

svn checkout http://bla.bla/some/relative/path

With git, you can only:

svn checkout http://bla.bla <-- I.e. you can't checkout sub directories

How do people get around this? My problem is specifically with deployment scripts. I have this directory structure:

/db
/www
etc
etc etc

So, I need to check out "www" to /home/mysite/public_html. But to do this, I would have to have the exact same structure (i.e. change www to public_html) AND I would have the added problem of it checking out db and all the other files to my home folder.

I do NOT want to have to check it out to a random folder and then have to copy it across, or rsynch it, or do any other stupid unnecessary steps.

So, how do others get around this?

UPDATE

It is extremely important that after the code is deployed, that I can simply go onto the server and type "git pull" from within the www directory, to get all the latest files.

rockstardev
  • 13,479
  • 39
  • 164
  • 296

1 Answers1

1

first, you can limit a Git repo to a coherent set of file (meaning in your www in one repo, db in another)

Second, if you have to keep everything in one repo, you can see if a sparse checkout can help.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Two repos is a bit overkill just to have this feature. I assume you refer to this: http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/ when you say sparse checkout? – rockstardev Sep 30 '14 at 11:06
  • 1
    @coderama this is not a "feature". This is a direct consequence of the decentralized nature of this tool (git): you clone the full history of one repo. It is important to keep that repo content tight, and not treat a repo as a giant base where you can throw everything. You can group repos in a main repo as submodules if you need to keep track of them together. – VonC Sep 30 '14 at 11:08