#!/bin/bash # # Commit updates # # Parameters PROJECT="$1" # Check if param is a project if [ ! -z "$PROJECT" ] && [ -z "$2" ] && ( cd $PROJECT &> /dev/null ); then if ! git status 2> /dev/null; then cd $PROJECT &> /dev/null shift elif git status $PROJECT | grep -q "$PROJECT (new commits)"; then cd $PROJECT &> /dev/null shift fi 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