Radek Liska
Radek Liska

Reputation: 251

How do I do an equivalent of "git add -p -w"?

There are about 5 relevant questions on this on SO, but I did not yet find the answer. The closest I have got is with the idea from this answer.

git diff -w --no-color | git apply --cached --ignore-whitespace

This doesn't work. It will add all the changes, but I want to do it per partes. Is there an improved way that also adds the behaviour -p flag of git add?

Upvotes: 2

Views: 51

Answers (1)

Kenney
Kenney

Reputation: 9093

This is one way:

git diff -w --no-color > patch 
git stash 
patch -p1 < patch
git add -i

Upvotes: 3

Related Questions