Pregunta

I'm trying to do a sparse checkout on an existing project with a whole repository checked out. The current structure is

database/ htdocs/ include/

But I only want include and certain folders from the htdocs directory.

So did the following:

git config core.sparsecheckout true

vi .git/info/sparse-checkout

and I entered

include
htdocs/*
!htdocs/downloads
!htdocs/images
!htdocs/videos

This worked in my testing environmen with git version git version 1.7.12.4 (Apple Git-37) but doesn't on an Ubuntu machine with git version 1.7.0.

On my server the whole include folder got deleted and on git pull it says everthing is up to date.

What am I missing here?

¿Fue útil?

Solución

Actually git v.1.7.0 does seem to have problems with foldernames.

Using this .git/info/sparse-checkout actually did work correctly

include/
htdocs/*
!htdocs/downloads/
!htdocs/images/
!htdocs/videos/

So the trailing slash wasn't needed on my Mac with a newer Git version but on the Linux server with an older Git.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top