In Git how can I stage a file I have just diffed without manually specifying the file?

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?

5
задан Dogbert 10 February 2011 в 10:44
поделиться