[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] * HACKING (Avoid trailing white space): Mention how git can
Re: [PATCH] * HACKING (Avoid trailing white space): Mention how git can help.
Tue, 03 Mar 2009 08:39:00 +0100
Ralf Wildenhues wrote:
> * Jim Meyering wrote on Mon, Mar 02, 2009 at 10:34:41PM CET:
>> Good idea. Thanks!
>> I'll push this tomorrow, unless you'd prefer something else.
> How about this instead? I looked at git a bit more, and have
> little experience with git apply (not sure whether it's used
> all over the place or not), so let's make that less prominent.
Looks good, but I had to make an additional change,
since the procedure changed in git-126.96.36.199.
>From 937ade894d77d16f3ba39d2547b68d55e330d3ad Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <address@hidden>
Date: Mon, 2 Mar 2009 22:33:05 +0100
Subject: [PATCH] * HACKING (Avoid trailing white space): Mention how git can
HACKING | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING
index 0675f9c..ad3e39f 100644
@@ -380,6 +380,25 @@ If you use vim, add this to ~/.vimrc:
match RedundantSpaces /\s\+$\| \+\ze\t/
+Git can help too, by stopping you from committing any change that would
+add trailing blanks. The example pre-commit hook contains code to check
+for trailing whitespace and spaces before tabs; enable it by moving it
+to the right place and making sure it is executable:
+ mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
+With a repository created by git-1.5.6 or older, use this command:
+ chmod +x .git/hooks/pre-commit
+To manually check for whitespace errors before committing, you can use
+ git diff --check
+Git also has some settings to enable suitable internal whitespace checks.
+See the manpage for git-apply for details.
Miscellaneous useful git commands