File: automatically_getting_files_on_checkout.mdwn

package info (click to toggle)
git-annex 8.20210223-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 68,764 kB
  • sloc: haskell: 70,359; javascript: 9,103; sh: 1,304; makefile: 212; perl: 136; ansic: 44
file content (15 lines) | stat: -rw-r--r-- 679 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.