Re:Ask HN: Best things in your bash_profile/aliases?
by m3at on Thursday January 24, 2019 @09:36PM
(#18995096)
Late on this as well but in case it's useful to you, I use this for quick "git add":
ga () {
if test "$#" -eq 0
then
echo "No arguments (0_0)?"
elif test "$#" -eq 1
then
git add -u && git commit -m "$(echo $1 | sed 's/^./\U&\E/')"
else
git add ${@:1:$(( $# - 1 ))} && git commit -m "$(echo ${@:$#} | sed 's/^./\U&\E/')"
fi
}
Usage: # Add all modified files and capitalize the commit message
ga "fix typo in README"
# Add some files and treat last arg as commit message
ga main.rs point.rs "speedup by 10e9"
This beautifully works as expected, I never got any bug because of this (as this could be expected for low level aliasing), and it does exactly what I'd expect: get current status of the current folder.
Now typing `git status` elsewhere is such a pain!