blob: f2575c2fce802f01e2cd1f67d9fcc498aa35a1fa (
plain)
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
|
#!/usr/bin/env bash
#
# Handy single command to clone or pull a repository
#
# Parameters
BASENAME="`basename $0`"
ORIGIN="$1"
DEST="$2"
# Check
if [ -z "$DEST" ]; then
echo "usage: $BASENAME <origin> <dest>"
exit 1
fi
# Dispatch
if [ ! -e "$DEST" ]; then
echo "Cloning $ORIGIN into $DEST..."
git clone $ORIGIN $DEST
else
echo "Updating $DEST..."
git -C $DEST pull
# Alternate approach, that restore any existing changes
#(
# cd $DEST &> /dev/null
# git restore .
# git pull
#)
fi
# Exit
exit $?
|