Arvind Mohan
Arvind Mohan

Reputation: 59

Is there a way to stage only modified files using "git add" ? (ie. ignore additions and deletions)

git add -u - adds only deleted or modified files.
git add --ignore-removal - adds only add and modified files but, is there a way to combine these both to add only modified files and ignore the additions and deletions

Upvotes: 2

Views: 139

Answers (1)

NiGiord
NiGiord

Reputation: 67

I found the solution here and here. Apparently there is no direct way in Git to do this, but a simple workaround is:

git diff --name-only --diff-filter=M | xargs git add

Upvotes: 1

Related Questions