I frequently diff a file, decide it's what I'll stage and then have to run the git add /long/path/to/file
to manually specify the file.
A usual work flow would go along the lines of:
git status
"oooh changes"
git diff /long/path/to/changed/file
"Yup, I remember that - commit time!"
git add /long/path/to/changed/file
Obviously this isn't the hardest thing in the world to do, it just gets a little tedious. I know I could go into interactive mode too, but that's never really fitted my work flow.
So I'm looking for some magic unix or git command where I can say "Hey, that file I just diffed - stage it please!".
Does something like that exist in either Git or Bash? Or is it something I need to build in a bash script?
Use
git add !$
More info: http://www.cyberciti.biz/faq/shell-call-last-argument-of-preceding-command/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With