summaryrefslogtreecommitdiff
path: root/doc/tips/automatically_getting_files_on_checkout.mdwn
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-02 13:32:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-02 13:32:19 -0400
commit8e249ea0bdbf0b0890d6e3d3ed1e30c1df36e136 (patch)
tree5209fb29a8a1c7c598801d36c672732ff1b51a20 /doc/tips/automatically_getting_files_on_checkout.mdwn
parente9286e7be7a8b68d9a0e02e909bf58c7936b12af (diff)
add tip for mode of operation somewhat like mercurial bigfiles extension
Diffstat (limited to 'doc/tips/automatically_getting_files_on_checkout.mdwn')
-rw-r--r--doc/tips/automatically_getting_files_on_checkout.mdwn15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/tips/automatically_getting_files_on_checkout.mdwn b/doc/tips/automatically_getting_files_on_checkout.mdwn
new file mode 100644
index 000000000..bbb3b302e
--- /dev/null
+++ b/doc/tips/automatically_getting_files_on_checkout.mdwn
@@ -0,0 +1,15 @@
+Normally git-annex does not retrieve file contents when checking out a
+tree. In some use cases, it makes sense to always have the contents of
+files available after a `git checkout` or `git update`. This can be
+accomplished by installing the following as `.git/hooks/post-checkout`
+
+ #!/bin/sh
+ # Uses git-annex to get all files in the specified directories
+ # (relative to the top of the repository) on checkout.
+ dirs=.
+ top="$(git rev-parse --show-toplevel)"
+ for dir in "$dirs"; do git annex get $top/$dir"; done
+
+By default, all files in the whole repository will be made available. The
+`dirs` setting can be configured if you only want to get files in certian
+directories.