In Git, how can I create the file I just modified without manually specifying the file?

I often parse the file, deciding what I will become, and then have to run git add /long/path/to/fileto manually specify the file.

A regular workflow will go line by line:

git status

"oooh changes"

git diff /long/path/to/changed/file

"Yes, I remember that - the time of fixation!"

git add /long/path/to/changed/file

Obviously, this is not the most difficult thing in the world, it is just a little tiring. I know that I can also go into interactive mode, but this really did not correspond to my work flow.

So, I'm looking for some kind of magic unix or git command, where I can say: "Hey, this file I just skipped - put it please!".

Is there something similar in git or bash? Or is this what I need to build in a bash script?

+5
4

bash. , :

git Alt .

Alt . . .

...

- , :

[you@home]$ git diff /some/path/to/file
[you@home]$ ^diff^add

bash :

, '^ string1 ^ string2 ^', string1 string2 .

^diff^add, , . . . .

+8

.bashrc :

alias addiff='fc -s "git diff=git add"'

addiff, git diff git add.

[you@home]$ git diff /some/path/to/file
[you@home]$ addiff

fc ( Fix Command) - bash. . -s .

fc alias r='fc -s' .bashrc. :

[you@home]$ r # repeat the previous command

[you@home]$ r git # repeat the last command containing the word "git"

[you@home]$ r foo=bar # repeat the last command, replace "foo" with "bar"
+3

:

git add .

.

0

All Articles