1

I am trying to pull all the files and folders within a specific folder in my git repository. I have already tried using sparce-checkout but this pulls the specific folder. I wish for it to only pull the files within the folder.

I have a folder called /EWINS/ and I wish to pull every folder and file within that directory.

I have tried:

git init

git config core.sparseCheckout true

git remote add -f origin https://MYDIRECTORY

echo "EWINS/*" >> .git/info/sparse-checkout

git pull origin master

However this results in the folder EWINS being pulled where as I require all the items within EWINS. Specifically I do not want the EWINS folder, simply all of the items within it.

I could theoretically specify every single file I want and that will work but I will have to be editing the script every time a new item which needs to be managed is added, and this is not appropriate.

I have referenced:

How do I clone a subdirectory only of a Git repository?

http://lakehanne.github.io/git-sparse-checkout

Any help would be appreciated.

Example:

I receive:

EWINS\app.test , text.txt, note.pad

I want:

app.test, text.txt, note.pad

Community
  • 1
  • 1
Anthony Drury
  • 128
  • 2
  • 12

1 Answers1

1

A Git sparse checkout still uses the working tree to restore its content. That means you would always get the EWINS folder.

My workaround would be to do this checkout in a dedicated folder, and then make a mirror-rsync with the right folder (which would be outside the Git repo, not managed by Git at all).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yea I was fretting having to another step. Always could run two scripts was just hoping there was some simple step I was missing. I will choose this as the answer if nothing else comes up. – Anthony Drury Feb 02 '17 at 22:32