forked from kollerma/git-submodule-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-rcheckout
executable file
·39 lines (32 loc) · 854 Bytes
/
git-rcheckout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash -e
## Do a recursive checkout
## this includes removing orphaned directories
## and attaching heads.
## read input, display help if necessary
if [[ "$@" == "" || "$@" == *--help* ]]; then
cat<<EOF
Recursive checkout
This command is like git-checkout, but acts recursively, i.e.,
makes sure that the submodules are at the correct commit,
their HEADs are attached if possible and orphaned submodule
directories are removed.
Usage:
git rcheckout ...
...: same arguments as git-checkout
EOF
exit 0;
fi
## from the git mailinglist:
function git
{
LC_MESSAGES=C command git "$@"
}
export git
## check for modified content and uncommitted changes
git check-clean || exit 1
## do the checkout
git checkout "$@" || exit 1
## fix submodule
git fix-submodules --skip-checks
## attach head (necessary?)
git attach-head