# Default .gitignore for Racket

**URL:** <https://racket.discourse.group/t/default-gitignore-for-racket/534>\
**Category:** Questions & Answers\
**Tags:** github\
**Created:** [January 7, 2022, 2:30pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534 "2022-01-07T14:30:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [January 7, 2022, 2:30pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/1 "2022-01-07T14:30:00Z")

</div>

The `git` command uses the file `.gitignore` to learn about files whose changes doesn't matter.

Do you have one to share?

Also, anyone up for the challenge of adding a default one for Racket on Github?

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/981a4d3fcaba5cffc728e05088f87dc1805d12b8.png)

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [January 7, 2022, 3:02pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/2 "2022-01-07T15:02:37Z")

</div>

`raco pkg new` (or whatever the syntax is) produces a default `.gitignore`:

```scheme

```

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [January 7, 2022, 3:07pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/3 "2022-01-07T15:07:11Z")

</div>

Nice! I did not know that. FWIW, here's the content of that file:

```scheme
*~
\#*
.\#*
.DS_Store
compiled/
/doc/

```

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [January 7, 2022, 3:08pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/4 "2022-01-07T15:08:18Z")

</div>

With the exception of the last 2 entries, though, most of what you get from this is that we tend to use Emacs on macOS....

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [January 7, 2022, 3:23pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/5 "2022-01-07T15:23:07Z")

</div>

I had that in my email; apparently it did not come through

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [January 7, 2022, 3:25pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/6 "2022-01-07T15:25:36Z")

</div>

Yes; in fact, it might be nicer to omit those things and let folks configure them globally, so that the default is just

```scheme
compiled/
/doc/

```

Examples: [.gitignore all the .DS\_Store files in every folder and subfolder - Stack Overflow](https://stackoverflow.com/q/18393498/4400820), [GitHub - tpope/vim-pathogen: pathogen.vim: manage your runtimepath](https://github.com/tpope/vim-pathogen#faq), [Dotfiles/gitignore\_global at master · benknoble/Dotfiles · GitHub](https://github.com/benknoble/Dotfiles/blob/master/links/gitignore_global)

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [January 7, 2022, 5:13pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/7 "2022-01-07T17:13:49Z")

</div>

The relevant repo is here.

Anyone interested in making a pull request on behalf of Racket?

> **[GitHub - github/gitignore: A collection of useful .gitignore templates](https://github.com/github/gitignore)**
>
> A collection of useful .gitignore templates. Contribute to github/gitignore development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)\
**Post date:** [January 7, 2022, 10:00pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/8 "2022-01-07T22:00:57Z")

</div>

Some of those are files that DrRacket creates. It might make sense to put in the standard set that Racket Mode, DrRacket, and the language server-supported IDEs tend to do?

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 7, 2022, 10:48pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/9 "2022-01-07T22:48:43Z")

</div>

> [@jbclements](#):
>
> ```scheme
> *~
> \#*
> .\#*
> .DS_Store
> compiled/
> /doc/
> 
> ```

Done

> <https://github.com/github/gitignore/pull/3943>
>
> \*\*Reasons for making this change:\*\*
> 
> I want git to ignore temporary files in r…acket repos
> 
> \*\*Links to documentation supporting these rule changes:\*\*
> 
> https://github.com/racket/racket/blob/ccdbe0a53ddb06ce6f538dba5eddecd03ef15985/racket/collects/pkg/private/new.rkt#L115
> 
> \## If this is a new template: YES
> 
> - \*\*Link to application or project’s homepage\*\*:
>  
> https://github.com/racket/racket
> 
> https://racket-lang.org/

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [January 15, 2022, 4:42pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/10 "2022-01-15T16:42:32Z")

</div>

I'm not sure about ignoring `.#*` files? I left a [comment on the PR](https://github.com/github/gitignore/pull/3943#discussion_r785331149) just now.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 15, 2022, 4:48pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/11 "2022-01-15T16:48:01Z")

</div>

I’ve updated the PR to remove these lines

```scheme
\#*
.\#*

```

---

<div class="post-metadata">

**Author:** ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)\
**Post date:** [January 15, 2022, 11:13pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/12 "2022-01-15T23:13:22Z")

</div>

@greghendershott: do you think that [https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt#L119](https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt#L119) should be changed as well? If so, I suggest that we do that first, since it will justify the change for the PR.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 16, 2022, 3:05pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/13 "2022-01-16T15:05:49Z")

</div>

> <https://github.com/racket/racket/pull/4128>
>
> Remove
> \\#\*
> .\\#\*
> As per https://racket.discourse.group/t/default-gitignore-for…-racket/534/12?u=spdegabrielle

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 16, 2022, 3:06pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/14 "2022-01-16T15:06:28Z")

</div>

> [@sorawee](#):
>
> @greghendershott: do you think that [https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt#L119](https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt#L119) should be changed as well? If so, I suggest that we do that first, since it will justify the change for the PR.

Pull request created

> <https://github.com/racket/racket/pull/4128>
>
> Remove
> \\#\*
> .\\#\*
> As per https://racket.discourse.group/t/default-gitignore-for…-racket/534/12?u=spdegabrielle

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [January 16, 2022, 3:06pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/15 "2022-01-16T15:06:30Z")

</div>

1. I'm not sure I understand the full context/intent/spirit for the `github/gitignore` repo? But it looks like they have a set of language templates, and a _separate_ set of "global" templates for e.g. editors. (Including [one for Emacs](https://github.com/github/gitignore/blob/main/Global/Emacs.gitignore) -- which includes `\.#` so they don't share my opinion; that's fine.)

2. As for the `raco pkg new` template, I think that can set its own rules. It's not trying to be some ideal taxonomy of curated `.gitignore` files, like that `github/gitignore` repo. Instead it's trying to help people create a new package; it could err on the side of including more things. Personally, I would try to include more things in my own `.gitignore`, to cover contributors using various operating systems and editors.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 16, 2022, 3:17pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/16 "2022-01-16T15:17:38Z")

</div>

> [@greghendershott](#):
>
> 1. I'm not sure I understand the full context/intent/spirit for the `github/gitignore` repo? But it looks like they have a set of language templates, and a _separate_ set of "global" templates for e.g. editors. (Including [one for Emacs](https://github.com/github/gitignore/blob/main/Global/Emacs.gitignore) -- which includes `\.#` so they don't share my opinion; that's fine.)

This is what it says at github/gitignore:

> This is GitHub’s collection of [`.gitignore`](http://git-scm.com/docs/gitignore) file templates. We use this list to populate the `.gitignore` template choosers available in the [GitHub.com](http://GitHub.com) interface when creating new repositories and files.

— [GitHub - github/gitignore: A collection of useful .gitignore templates](https://github.com/github/gitignore)

I was taking that to mean you will be able to select Racket when you use the ‘new repo’ action.

 ![screenshot of gitignore language selector in GitHub](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/78c6f034a7e6cf9300cef63657ee012b040205ee.jpeg)

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [January 16, 2022, 5:13pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/17 "2022-01-16T17:13:27Z")

</div>

👍@spdegabrielle From that description, plus from looking at some of the top-level, language `.gitignore` files in that repo: It seems like `github/gitignore` would want the file for Racket to be only the things unique to Racket, which I guess is just:

```scheme
compiled/
/doc/

```

It seems like their intent is that people would populate a global gitignore from things in the `/Global` directory of that repo.

* * *

As for `raco pkg new`, I think it's OK for it to have a different policy than `github/gitignore`.

Assuming it continues to include some OS- and editor-specific things like `.DS_Store` and `*~` (which I personally think is fine) I just have the (tiny) opinion that it no longer include the `.\#` pattern for Emacs "lock files".

---

<div class="post-metadata">

**Author:** ![simonls](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/simonls/32/170_2.png) [@simonls](https://racket.discourse.group/u/simonls)\
**Post date:** [January 16, 2022, 11:02pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/18 "2022-01-16T23:02:42Z")

</div>

> [@greghendershott](#):
>
> Assuming it continues to include some OS- and editor-specific things like `.DS_Store` and `*~` (which I personally think is fine) I just have the (tiny) opinion that it no longer include the `.\#` pattern for Emacs "lock files".

I personally recommend to anyone who hasn't done so, to configure their own global gitignore to ignore things like this, on their computer for all git repositiories. Mostly because it is convenient, you only have to do it once (instead of for every repository) and then you don't have to hope that somebody has included the things that annoy you (which they shouldn't have to do anyway, because those are unbounded and platform/editor specific)

I think adding these platform specific things in a git repo template is like giving somebody a fish, instead of teaching them how to fish. The global gitrepo config enables everyone to change it to their liking without imposing unnecessary "boilerplate" repetitive configuration for every repository.  
That said sometimes you just want a warm meal without cooking it yourself, so I can understand the desire to go with the "feels wrong, but slightly easier to use" solution.

> **[Ignoring files - GitHub Docs](https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer)**
>
> You can configure Git to ignore files you don't want to check in to GitHub.

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [January 17, 2022, 3:00pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/19 "2022-01-17T15:00:29Z")

</div>

I agree about teaching people to fish! OTOH I'm also sympathetic to projects feeling they don't have time to use pull requests as a teaching opportunity.

For example I'd find it hard to argue with a project that adds `.DS_Store` files to its `.gitignore` if they keep getting those in PRs.

* * *

(For Racket Mode for Emacs I even supply a [`.dir-locals.el`](https://github.com/greghendershott/racket-mode/blob/master/.dir-locals.el) to guide contributors about things like tabs, whitespace, final newlines, etc. 🙂)

---

<div class="post-metadata">

**Author:** ![simonls](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/simonls/32/170_2.png) [@simonls](https://racket.discourse.group/u/simonls)\
**Post date:** [January 17, 2022, 5:23pm UTC](https://racket.discourse.group/t/default-gitignore-for-racket/534/20 "2022-01-17T17:23:58Z")

</div>

> [@greghendershott](#):
>
> For example I'd find it hard to argue with a project that adds `.DS_Store` files to its `.gitignore` if they keep getting those in PRs.

I wonder how easy/difficult it would be to instead write a git hook that rejects those files and gives an error message about using global gitignore and removing those from the commit. I think that would be what I would try to do in that situation. So far I didn't need git hooks so I am not very familiar with them.

* * *

Also might be nice if platform specific git packages for example via homebrew had pre-configured those files to be ignored. Even better would be if programs didn't pollute directories with lots of tempfiles.

Imagine there was something like a "gensym" for filesystem pathes, an opaque capability like unique value and filesystems could somehow contain those as subdirectories and put all their application specific files in there. This way nobody would have to see those `.DS_Store` files. There might be a lot of other ways to handle this, but it irks me that this filesystem centric approach leaks data that should not be seen (caching should be transparent/invisible). A whole other thing is the potential for conflicts / exploits between applications. But I am ranting to much and getting off topic. 😅

[Next page](https://racket.discourse.group/t/default-gitignore-for-racket/534.md?page=2)
