From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Neukirchen Subject: Re: git add without whitespace Date: Tue, 31 May 2016 17:59:45 +0200 Message-ID: <87pos2tdzi.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue May 31 18:00:07 2016 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b7m5K-0007gx-Kz for gcvg-git-2@plane.gmane.org; Tue, 31 May 2016 18:00:03 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288AbcEaP76 (ORCPT ); Tue, 31 May 2016 11:59:58 -0400 Received: from plane.gmane.org ([80.91.229.3]:46137 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbcEaP74 (ORCPT ); Tue, 31 May 2016 11:59:56 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1b7m5A-0007bP-Hs for git@vger.kernel.org; Tue, 31 May 2016 17:59:52 +0200 Received: from host120-2.natpool.mwn.de ([138.246.2.120]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 May 2016 17:59:52 +0200 Received: from chneukirchen by host120-2.natpool.mwn.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 May 2016 17:59:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: host120-2.natpool.mwn.de In-Reply-To: (Junio C. Hamano's message of "Mon, 30 May 2016 12:06:05 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Junio C Hamano writes: > Robert Dailey writes: > >> $ 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 http://chneukirchen.org