Skip to content

Instantly share code, notes, and snippets.

@sbellware
Created March 20, 2011 17:13
Show Gist options
  • Save sbellware/878463 to your computer and use it in GitHub Desktop.
Save sbellware/878463 to your computer and use it in GitHub Desktop.
function changes {
start="$1"
end="$2"
if [ -z "$2" ]; then
start="$1"^
end="$1"
fi
if [ -z "$1" ]; then
start=HEAD^
end=HEAD
fi
git diff --name-only $start..$end | sort | uniq
}
@shajra
Copy link

shajra commented Mar 20, 2011

I came to the conclusion that your if-then logic is readable relative to any fancy shell parameter expansion I can come up with (which I gave up on). I think you have what you need to figure it out now.

@perfectionist
Copy link

For future reference I recommend the Advance Bash Scripting Guide - PDF / HTML versions at http://tldp.org/guides.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment