Reputation:
From the research I've come across, they both seem to do the same thing. From the git documentation, git-add adds the file contents to the index while git update-index 'registers' it. Not sure what is meant by register and how that differs from add.
Upvotes: 0
Views: 75
Reputation: 487983
As a user-facing (or porcelain) command, git add
has a lot of user-oriented features, including:
git update-index
does not use or accept pathspecs, but git add
does, so git add :(attr:text)/
would add only files marked specifically "text" in .gitattributes
, for instance.-a
, -A
, --ignore-removal
, -u
, and so on.--patch
or -p
option, which invokes a separate Perl program that creates a diff between the index and work-tree copies of a file and lets you pick and choose parts of that diff to apply to the index.There are no doubt additional things not covered here, and will be more over time. Meanwhile, as a plumbing command, git update-index
has abilities that are not suitable for direct use by humans, such as the ability to put files into particular staging slots.
Upvotes: 2