Thread (1 message) 1 message, 1 author, 2016-06-16

Re: git add without whitespace

From: Christian Neukirchen <hidden>
Date: 2016-06-16 02:19:40

Junio C Hamano [off-list ref] writes:
Robert Dailey [off-list ref] writes:
quoted
$ git diff -U0 -w --no-color | git apply --cached --ignore-whitespace
--unidiff-zero

This command explicitly leaves out context because it can sometimes
cause the patch to fail to apply, I think due to whitespace being in
it, but I'm not completely sure myself.
I have had this in my ~/.gitconfig for a long time.

[alias]
	wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached --whitespace=fix;\
		git co -- ${1-.} \"$@\"' -"
Very useful, thanks for sharing!

I wonder which other gems are in your .gitconfig, is it public?

-- 
Christian Neukirchen  [off-list ref]  http://chneukirchen.org
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help