aboutsummaryrefslogtreecommitdiff
path: root/commit-updates
blob: ab56b2ed0f4ded550594a36a6c4d79a44f99ab04 (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
#!/bin/bash
#
# Commit updates
#

# Parameters
PROJECT="$1"

# Check if param is a project
if [ ! -z "$PROJECT" ] && [ -z "$2" ] && ( cd $PROJECT &> /dev/null ); then
  cd $PROJECT &> /dev/null
  shift
fi

# Commit message
ARGS="$*"

# Simply update commit
if git status &> /dev/null; then
  if [ ! -z "$ARGS" ]; then
    commit "Updates $ARGS"
  else
    commit "Updates $(basename `pwd`)"
  fi
else
  mr commit -m "Updates"
  mr fetch
fi