# [PATCH] .gitignore: Ignore editor backup and swap files

7 messages from 2014-01-16 to 2014-01-17. Participants: Alexander Berntsen, Junio C Hamano, Jonathan Nieder, Ramsay Jones, David Kastrup, Duy Nguyen.
Thread: https://gitlist.dev/t/35674

## Alexander Berntsen, 2014-01-16 21:19

Subject: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <1389907164-13400-1-git-send-email-alexander@plaimi.net>
URL: https://gitlist.dev/e/1389907164-13400-1-git-send-email-alexander%40plaimi.net

```
Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
---
 .gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index b5f9def..2905c21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -240,3 +240,5 @@
 *.pdb
 /Debug/
 /Release/
+*~
+.*.swp
-- 
1.8.3.2

```

## Junio C Hamano, 2014-01-16 22:06

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <xmqqtxd3y43b.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqtxd3y43b.fsf%40gitster.dls.corp.google.com
In-Reply-To: <1389907164-13400-1-git-send-email-alexander@plaimi.net>

```
Alexander Berntsen <alexander@plaimi.net> writes:

> Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
> ---
>  .gitignore | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/.gitignore b/.gitignore
> index b5f9def..2905c21 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -240,3 +240,5 @@
>  *.pdb
>  /Debug/
>  /Release/
> +*~
> +.*.swp

I personally do not mind listing these common ones too much, but if
I am not mistaken, our policy on this file so far has been that it
lists build artifacts, and not personal preference (the *.swp entry
is useless for those who never use vim, for example).

These paths that depend on your choice of the editor and other tools
can still be managed in your personal .git/info/exclude in the
meantime.

```

## Alexander Berntsen, 2014-01-16 22:15

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <52D85A1F.1010702@plaimi.net>
URL: https://gitlist.dev/e/52D85A1F.1010702%40plaimi.net
In-Reply-To: <xmqqtxd3y43b.fsf@gitster.dls.corp.google.com>

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 16/01/14 23:06, Junio C Hamano wrote:
> I personally do not mind listing these common ones too much, but if
> I am not mistaken, our policy on this file so far has been that it
>  lists build artifacts, and not personal preference (the *.swp
> entry is useless for those who never use vim, for example).
I don't see any downside to having this in .gitignore. However, not
including it doesn't significantly impede my workflow either. I will
not argue ferociously for this patch's inclusion. :-)

- -- 
Alexander
alexander@plaimi.net
http://plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlLYWh8ACgkQRtClrXBQc7X7WAD9GTUId4ipGdL334Oo6Yn9duSA
qixEG95nJ2FsGz5/KNsA/icUkn2BYZRCHevsnYyUFkinOiApckkqpMOTAk5Wsd4D
=7Fvb
-----END PGP SIGNATURE-----

```

## Jonathan Nieder, 2014-01-16 22:43

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <20140116224334.GS18964@google.com>
URL: https://gitlist.dev/e/20140116224334.GS18964%40google.com
In-Reply-To: <xmqqtxd3y43b.fsf@gitster.dls.corp.google.com>

```
Junio C Hamano wrote:

> These paths that depend on your choice of the editor and other tools
> can still be managed in your personal .git/info/exclude in the
> meantime.

Or $HOME/.config/git/ignore to not have to make the same setting
in every repository. :)

Maybe it would make sense to add a hint about that somewhere to
user-manual.txt.  Even better would be to automatically include some
common exclude patterns globally without requiring any manual
configuration, but that would take some care to make sure the patterns
and how to disable them are documented clearly.

-- >8 --
Subject: gitignore doc: add global gitignore to synopsis

The gitignore(5) manpage already documents $XDG_CONFIG_HOME/git/ignore
but it is easy to forget that it exists.  Add a reminder to the
synopsis.

Noticed while looking for a place to put a list of scratch filenames
in the cwd used by one's editor of choice.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/gitignore.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index f971960..37c9470 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
 
 SYNOPSIS
 --------
-$GIT_DIR/info/exclude, .gitignore
+$HOME/.config/git/ignore, $GIT_DIR/info/exclude, .gitignore
 
 DESCRIPTION
 -----------
-- 
1.8.5.2

```

## Ramsay Jones, 2014-01-16 22:56

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <52D863AF.30506@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/52D863AF.30506%40ramsay1.demon.co.uk
In-Reply-To: <xmqqtxd3y43b.fsf@gitster.dls.corp.google.com>

```
On 16/01/14 22:06, Junio C Hamano wrote:
> Alexander Berntsen <alexander@plaimi.net> writes:
> 
>> Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
>> ---
>>  .gitignore | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/.gitignore b/.gitignore
>> index b5f9def..2905c21 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -240,3 +240,5 @@
>>  *.pdb
>>  /Debug/
>>  /Release/
>> +*~
>> +.*.swp
> 
> I personally do not mind listing these common ones too much, but if
> I am not mistaken, our policy on this file so far has been that it
> lists build artifacts, and not personal preference (the *.swp entry
> is useless for those who never use vim, for example).
> 
> These paths that depend on your choice of the editor and other tools
> can still be managed in your personal .git/info/exclude in the
> meantime.

As a vim user, I have these set in my ~/.gitignore file, which I refer
to from ~/.gitconfig using core.excludesfile. ;-)


ATB,
Ramsay Jones

```

## David Kastrup, 2014-01-17 04:48

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <87fvonz008.fsf@fencepost.gnu.org>
URL: https://gitlist.dev/e/87fvonz008.fsf%40fencepost.gnu.org
In-Reply-To: <xmqqtxd3y43b.fsf@gitster.dls.corp.google.com>

```
Junio C Hamano <gitster@pobox.com> writes:

> Alexander Berntsen <alexander@plaimi.net> writes:
>
>> Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
>> ---
>>  .gitignore | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/.gitignore b/.gitignore
>> index b5f9def..2905c21 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -240,3 +240,5 @@
>>  *.pdb
>>  /Debug/
>>  /Release/
>> +*~
>> +.*.swp
>
> I personally do not mind listing these common ones too much, but if
> I am not mistaken, our policy on this file so far has been that it
> lists build artifacts, and not personal preference (the *.swp entry
> is useless for those who never use vim, for example).
>
> These paths that depend on your choice of the editor and other tools
> can still be managed in your personal .git/info/exclude in the
> meantime.

Here is a somewhat related question: if one places a file .dir-locals.el
in the top directory of the checkout with the contents:

;;; Directory Local Variables
;;; See Info node `(emacs) Directory Variables' for more information.

((c-mode
  (c-default-style . "linux")
  (indent-tabs-mode . t)))


Then all edits in the whole checkout done with Emacs in C files use the
right indentation style.  Obviously, that's a "personal preference"
setting in that it is useless for those who never use Emacs (the file
can be written/edited using M-x add-dir-local-variable RET).  It's still
providing significant convenience for a number of users while touching
only a single file.

-- 
David Kastrup

```

## Duy Nguyen, 2014-01-17 06:20

Subject: Re: [PATCH] .gitignore: Ignore editor backup and swap files
Message-ID: <CACsJy8DcrR0Rgp0cE+Va2ZBfvtvEJiFxkoXMrkwPj9bn621m9Q@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8DcrR0Rgp0cE%2BVa2ZBfvtvEJiFxkoXMrkwPj9bn621m9Q%40mail.gmail.com
In-Reply-To: <20140116224334.GS18964@google.com>

```
On Fri, Jan 17, 2014 at 5:43 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Subject: gitignore doc: add global gitignore to synopsis
>
> The gitignore(5) manpage already documents $XDG_CONFIG_HOME/git/ignore
> but it is easy to forget that it exists.  Add a reminder to the
> synopsis.

Yes! I knew about the xdg thing but was not aware about
$xdg/git/ignore. No more updating .git/info/exclude on every newly
cloned repo..
-- 
Duy

```
