CLI Tricks: diff files in git and then add them
Occasionally I want to
diff
one or more files in
git
and, if everything looks good,
then add them.
To do so,
I often take advantage of
bash
's
^
notation to do a replacement:
The second command replaces
diff
with
add
turning the command into
git add -- file1.txt file2.txt
without having to retype the entire command.