Skip to content

Instantly share code, notes, and snippets.

@hgupta
Created December 3, 2012 11:42
Show Gist options
  • Save hgupta/4194436 to your computer and use it in GitHub Desktop.
Save hgupta/4194436 to your computer and use it in GitHub Desktop.
Committing multiple files to SVN using CLI (with confirmation)
#! /bin/bash
# Usage
# (I added an alias in .bashrc as follows)
# alias svnci='/path/to/this/shell/script'
# and make this shell script executable
# or you may simply add
# alias svnci='sh /path/to/this/shell/script'
# > svnci
# > svnci folder
# > svnci -m "message"
# > svnci folder -m "message"
commit_msg="Committed by Harsh on "`date +"%m-%d-%Y, %T"`
tmp_sep=" -- "
while getopts m: opt
do
case "$opt" in
m) commit_msg=$OPTARG$tmp_sep$commit_msg;;
esac
done
#echo $commit_msg
#svn status $1 | grep "^M" | awk '{print $2}'
echo "Commit following files to the repository?"
for file in `svn status $1 | grep "^[M|A]" | awk '{print $2}' `
do
echo -n "$file ? "
read decision
case "$decision" in
y | Y | yes | YES | Yes ) svn ci $file -m $message;;
*)
esac
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment