3 #==============================================================================
5 # File ID: 96b89f6a-d1eb-11e7-9056-f74d993421b0
7 # Make a full Git update in the current repository
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
16 T_GREEN
=$
(tput setaf
2)
23 while test -n "$1"; do
25 -h|
--help) opt_help
=1; shift ;;
26 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
27 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
28 --version) echo $progname $VERSION; exit 0 ;;
31 if printf '%s\n' "$1" |
grep -q ^
-; then
32 echo "$progname: $1: Unknown option" >&2
40 opt_verbose
=$
(($opt_verbose - $opt_quiet))
44 echo "$T_GREEN$progname: $*$T_RESET" >&2
48 if test "$opt_help" = "1"; then
49 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
52 Make a full Git update in the current repository. Fetch everything from
53 all remotes, update all local branches and create commit-* branches from
56 Usage: $progname [options]
63 Be more quiet. Can be repeated to increase silence.
65 Increase level of verbosity. Can be repeated.
67 Print version information.
73 repotop
="$(git rev-parse --show-toplevel)"
74 if [ -z "$repotop" ]; then
75 echo $progname: Not
in a Git repository
>&2
80 echo $progname: $repotop: Cannot chdir to top of repo
>&2
84 currbranch
=$
(git rev-parse
--abbrev-ref HEAD
)
89 if test -n "$currbranch" -a "$currbranch" != "HEAD"; then
90 runcmd git checkout
"$branch"
92 echo -n "$T_RED$progname: " >&2
93 echo "No current branch, skip \"git checkout $branch\"$T_RESET" >&2
97 runcmd git fetch
--all --prune
98 runcmd git merge
--ff-only
99 safe_checkout $
(git rev-parse HEAD
)
104 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :