Git sparse check with exception

According to this thread , an exception in the Git sparse-checkout function is supposed to be implemented. It?

Suppose I have the following structure:

 papers/ papers/... presentations/ presentations/heavy_presentation presentations/... 

Now I want to exclude presentations/heavy_presentation from the check, leaving the rest at the checkout. I could not achieve this. What is the correct syntax for this?

+7
source share
3 answers

I would expect something like below:

 /* !presentations/heavy_presentation 

But this is not so. And I tried many other combinations. I think the exception is not being executed properly and there are errors around it (still)

Something like:

 presentations/* !presentations/heavy_presentation 

really works, and you get a presentation folder without the heavy_presentation folder.

So, a workaround would be to include everything else explicitly.

+4
source

I had the same problem. I fixed it with something like:

 !presentations/heavy_presentation presentations/* 

As I understand it, it works: It reads a file rule by the rule. If something is included, it includes all the paths that contain this word, and it no longer changes its status until the end of the sparse check. If you add an exclusion rule before inclusion, in my opinion, it will delete the files first, and then mark everything that is included.

I'm not quite sure, this is what I assumed based on my experience and working for me. Hope this helps someone.

+3
source

Unfortunately, none of the above worked for me, so for a very long time I tried a different combination of the sparse-checkout file.

In my case, I wanted to skip the IntelliJ IDEA configuration folders.

Here is what I did:


Run git clone https://github.com/myaccount/myrepo.git --no-checkout

Run git config core.sparsecheckout true

Created .git\info\sparse-checkout with the following contents

 !.idea/* !.idea_modules/* /* 

Run 'git checkout -' to get all the files.


The key task to make it work was to add /* after the folder name.

I have git 1.9

+3
source

All Articles