From: Junio C Hamano Date: Wed, 12 Feb 2014 19:28:55 GMT Subject: Re: [PATCH] Make the global packed_git variable static to sha1_file.c. Message-ID: In-Reply-To: Stefan Zager writes: > If anyone has a recommendation for a less labor-intensive way to do > this in emacs, I'd be very grateful. This is not "do this in emacs", but here is a possible approach. You can ask "git diff" about what you changed, and actually apply the change while fixing whitespace errors. I.e. git diff sha1_file.c | git apply --cached --whitespace=fix git diff git checkout sha1_file.c The first step will add a cleaned-up version to your index. The second "diff" (optional) is to see what whitespace errors are introduced when going from that cleaned-up version to what you have in the working tree. With the last step you would update the working tree version to the cleaned-up version from the index. [alias] wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached --whitespace=fix;\ git co -- ${1-.} \"$@\"' -"