A zsh function to Add Last Parameter of Last Command to git
My git worflow often has me changing several files, and testing the changes before I commit anything to any of the files. I find the easiest way to do a commit per file is to ensure that I review the code of each file just before I commit. That way I can also ensure that the commit message is just a bit accurate, as I make no assumptions to what the change was before commiting. (Admit it, it has happened to you too!).
Lazy as I am however, I was tired of writing pretty much the same command twice, or going back in history and changing diff to add before my commit.
git diff Some/Path/To/File.ext git add Some/Path/To/File.ext git commit -m "Commit message here"
(Yes, I know I can specify the file in the commit directly, for some reason - I never have). I created a minor zsh function to take the last parameter of the last command, and adding that parameter to the git add command.
gd Some/Path/To/File.ext gal c -m "Commit message here"
