2

As indicated in the documentation (and the answer to this question):

  • git -u : adds modifications and removals to the index
  • git -A : adds modifications, removals and additions to the index

Is there a 1-line git command that only adds file modifications, and not additions/deletions?

I want an easy way to add all of my edits, but don't want this action to add/remove files by default (I'll do that explicitly).

Community
  • 1
  • 1
Dave
  • 7,555
  • 8
  • 46
  • 88

2 Answers2

3

You could something like this:

git add $(git diff-files --diff-filter=M --name-only)

Resources:

Colin Hebert
  • 91,525
  • 15
  • 160
  • 151
1

I suggest that you use

git add -p

it allows you to select changes interesting you.

elhadi dp ıpɐɥןǝ
  • 4,763
  • 2
  • 30
  • 34