Basically I\'m trying to alias:
git files 9fa3
...to execute the command:
git diff --name-status 9fa3^ 9fa3
I wanted to do this with an alias that does this:
git checkout $1;
git merge --ff-only $2;
git branch -d $2;
In the end, I created a shell script named git-m that has this content:
#!/bin/bash -x
set -e
#by naming this git-m and putting it in your PATH, git will be able to run it when you type "git m ..."
if [ "$#" -ne 2 ]
then
echo "Wrong number of arguments. Should be 2, was $#";
exit 1;
fi
git checkout $1;
git merge --ff-only $2;
git branch -d $2;
This has the benefit that it's much more legible because it's on multiple lines. Plus I like being able to call bash with -x
and set -e
. You can probably do this whole thing as an alias, but it would be super ugly and difficult to maintain.
Because the file is named git-m
you can run it like this: git m foo bar