What are Sparse Checkouts?
If you have a git repo that you have cloned to your local machine, but, there are certain files/folders that you don’t want to see – but, you don’t want to remove them from the repo – you can use sparse checkouts.
Sparse Checkouts have to be explicity enabled for each repo. And, after using them for the first time today, there seem to be some quirks that I can hopefully help you from experiencing.
I’m using a Mac 10.9.2, with Git Version: 188.8.131.52 (Apple Git-47).
How To use Sparse Checkouts?
First you need to enable them for your repo. In your repo use:
git config core.sparseCheckout true
Next, you need to set up your includes/excludes – each entry is on a separate line in a file called ‘.git/info/sparse-checkouts’. For includes, you can use wildcard or specify the specific file/folder. For excludes, you do the same but start with a ‘!’. Unfortunately, there seem to be some quirks with this, especially with folder excludes. After a lot of trial and error, I came up with the following.
cd $GIT_DIR echo "/*" > .git/info/sparse-checkout echo "!server/" >> .git/info/sparse-checkout git read-tree -mu HEAD
This will includes all files/folder in the root, except for the ‘server’ folder which is hidden.
You can also do this for submodules, the difference being that you need to specify those in a different sparse-checkout file (one for each submodule):
cd $GIT_DIR echo "/*" > .git/modules/<MODULEPATH>/info/sparse-checkout echo "!server/" >> .git/modules/<MODULEPATH>/info/sparse-checkout git read-tree -mu HEAD
First you have to remove any sparse-checkout settings, then, you can disable them.
echo "/*" > .git/info/sparse-checkout echo "/*" > .git/modules/<MODULEPATH>/info/sparse-checkout git read-tree -mu HEAD git config core.sparseCheckout false
Hope this helps.
TextBar is a tiny but powerful app that lets you add any text to your MenuBar.
After a month of using my Hazel-based filing system, I’ve made a minor improvement that has had a big benefit.
Whilst the automated clean-up mechanism mentioned in My Mac and Me – Filing #1 has been very useful, one problem is that it takes a day for content to be tidyied up. Sometimes, there is a file on the Desktop that you want to be tidyied up immediately.
The solution is pretty simple.
I’ve added a new rule to the Desktop folder in Hazel. This new rule is triggered when the color label for a file is set to red. When Hazel detects this, it removes the color label, and moves it immediately to my Notes folder – which then triggers the filing system described in My Mac and Me – Filing #2.