git add -p is Short for git add --patch

Tadashi Shigeoka ·  Thu, June 8, 2017

During engineer training, I was saying “git add -p is useful,” and I suddenly wondered “What does -p stand for?” so I looked it up.

Git

I thought it might be short for —partial since you can git add partially, but when I checked the help, it said it was an abbreviation for —patch.

$ git add -h    
usage: git add [options] [--] ...

    -n, --dry-run         dry run
    -v, --verbose         be verbose

    -i, --interactive     interactive picking
    -p, --patch           select hunks interactively
    -e, --edit            edit current diff and apply
    -f, --force           allow adding otherwise ignored files
    -u, --update          update tracked files
    -N, --intent-to-add   record only the fact that the path will be added later
    -A, --all             add changes from all tracked and untracked files
    --ignore-removal      ignore paths removed in the working tree (same as --no-all)
    --refresh             don't add, only refresh the index
    --ignore-errors       just skip files which cannot be added because of errors
    --ignore-missing      check if - even missing - files are 

I believe short option names are easier to remember when you understand the formal name of the option, so I’ll continue to look things up immediately whenever I have questions.

That’s all from the Gemba.