-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-pull
More file actions
executable file
·31 lines (24 loc) · 948 Bytes
/
git-pull
File metadata and controls
executable file
·31 lines (24 loc) · 948 Bytes
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
#!/bin/bash
SCRIPTSRC=`readlink -f "$0" || echo "$0"`
RUN_PATH=`dirname "${SCRIPTSRC}" || echo .`
source ${RUN_PATH}/_git_def.sh
DIR="$PWD"
cd ${DIR}
BRANCH_CURRENT=$(git rev-parse --abbrev-ref HEAD)
if [[ "${BRANCH_CURRENT}" == "" ]]; then
echo "... Error: empty branch"
else
echo "--------------------------------------------------------"
echo -e $BS"Run command: pull origin "${BRANCH_CURRENT}" (update "${BRANCH_CURRENT}")"$BE
echo "--------------------------------------------------------"
git pull --rebase origin ${BRANCH_CURRENT}
exit_on_error $? !!
if [[ "$1" != "" ]]; then
BRANCH_PULL=$1
echo "--------------------------------------------------------"
echo -e $BS"Run command: pull origin ${BRANCH_PULL} (merge ${BRANCH_PULL} to "${BRANCH_CURRENT}")"$BE
echo "--------------------------------------------------------"
git pull --rebase origin ${BRANCH_PULL}
exit_on_error $? !!
fi
fi