8 comments

  • Jenk6 minutes ago
    Since using jj I&#x27;m on the lookout for some kind of setting that will exclude the .jj folder from the repo _and_ any operation including git clean, without having to add it to the repo. I.e., make it completely invisible to git including `git clean -xdf`!<p>At the moment I&#x27;m making do with aliasing `git clean -e .jj`
  • masfuerte2 hours ago
    &gt; GitHub, GitLab, and Gitea all respect .gitignore and won’t show ignored files in the web UI<p>Is this right? These tools don&#x27;t show ignored files because they aren&#x27;t part of the repository. If a now-ignored file has made it into the repository, surely you want to see it?
    • silverwind2 hours ago
      Not true, you can push a file and later gitignore it and it will remain visible on those UIs. It&#x27;s still part of the repo.<p>Doing it the other way around is also possible but harder as the git client will refuse but can be convinced.
    • paulddraper2 hours ago
      Yeah this is wrong.<p>They will show the files in your repo.<p>gitignore just decides whether untracked files appear as new or ignored. (But you can commit them anyway if you are so inclined.)
      • chrisweekly1 hour ago
        how do you commit a file without first adding it?
        • JonathonW1 hour ago
          `git add -f` will add ignored files. Once you&#x27;ve done that, any files you&#x27;ve added will be part of your commit regardless of the contents of .gitignore.
          • chrisweekly1 hour ago
            Right... and also (I think; unsure bc I only ever use cli) some GUIs (eg github.com web ui) may enable adding files that&#x27;d otherwise be ignored.<p>(shrug)
    • wheybags8 minutes ago
      Yeah, also that&#x27;s probably not the kind of error a human writing this post would make... I stopped reading at that point
  • jakub_g45 minutes ago
    I&#x27;d like to emphasize the `.git&#x2F;info&#x2F;exclude`, which is a &quot;repo-local gitignore&quot;, i.e. only for you and only for this repo.<p>Useful when you want to create a temporary file to help you e.g. with a bug investigation, and make sure it stays untouched while you switch branches, and to avoid accidentally committing it.<p>I have a shell alias like this:<p><pre><code> git-ignore-local () { echo &quot;$1&quot; &gt;&gt; .git&#x2F;info&#x2F;exclude } </code></pre> and use it like `git-ignore-local myfile.ext`
    • theowaway21345637 minutes ago
      .git&#x2F;info&#x2F;exclude is mentioned in the first section (about .gitignore)
      • jakub_g30 minutes ago
        Oops, I&#x27;ve glanced over it too fast. Thanks - updated my post.
  • DHowett2 hours ago
    .git-blame-ignore-revs, while great, unfortunately belongs in the “Other Conventions” section.<p>If you configure your git client to use it, git blame will fail in any repository in which one is not present.
    • ilostmymangoman1 hour ago
      As of git 2.52, it&#x27;s possible to use (:optional) to avoid errors in repositories that don&#x27;t have this file <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;79824780" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;79824780</a>
  • semanticc1 hour ago
    &gt; GitHub’s contributor graphs use mailmap.<p>This is not true, .mailmap is [unfortunately] not supported by GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;orgs&#x2F;community&#x2F;discussions&#x2F;22518" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;orgs&#x2F;community&#x2F;discussions&#x2F;22518</a>
  • retrodaredevil3 hours ago
    This is a well put together list. One thing that frustrates me is that not all tooling respects mailmap. IntelliJ has an open feature&#x2F;bug request for integrating mailmap into its git functionality. Additionally, the .git-blame-ignore-revs is more of a convention because you still have to manually configure that to be the file name to use.
  • paulddraper4 hours ago
    &gt; Global ignores are good for OS-specific files like .DS_Store or Thumbs.db that shouldn’t clutter every project’s .gitignore.<p>News to me and a lot of people.<p>I see a lot of .DS_Store in a lot of gitignore.
    • jasonhansel5 minutes ago
      More importantly, it avoids the issue where every new editor requires an addition to every repository&#x27;s gitignore file (.idea, .vscode, etc).<p>IMO, it&#x27;s best to keep things that are &quot;your fault&quot; (e.g. produced by your editor or OS) in your global gitignore, and only put things that are &quot;the repository&#x27;s fault&quot; (e.g. build artifacts, test coverage reports) in the repository&#x27;s gitignore file.
    • jmholla4 hours ago
      You still want to put these kinds of things in every project where you are collaborating. You can&#x27;t depend on everyone to know and do this, so best to just be prepared for those who don&#x27;t.
      • phyzome3 hours ago
        I&#x27;d prefer to leave them out. That way I can see who&#x27;s not paying attention when they make commits and are just doing `git commit -a -m &quot;yolo&quot;`.
      • Defletter4 hours ago
        I have this two liner as part of my post-os-install setup script:<p><pre><code> curl -fsSL https:&#x2F;&#x2F;www.toptal.com&#x2F;developers&#x2F;gitignore&#x2F;api&#x2F;linux &gt; ~&#x2F;.gitignore git config --global core.excludesFile ~&#x2F;.gitignore</code></pre>
        • OJFord4 hours ago
          Assuming your global config is ~&#x2F;.config&#x2F;git&#x2F;config, you can download it to ~&#x2F;.config&#x2F;git&#x2F;ignore and not need the overriding explicit excludesFile.
    • OJFord4 hours ago
      I have mixed feelings about it really, I am aware of it, and use it in my dot files, but I think it&#x27;s quite a gotcha - just recently actually I&#x27;ve been thinking to remove it.<p>It catches <i>me</i> out when something&#x27;s ignored I don&#x27;t expect, and it&#x27;s not clear why in the working directory&#x2F;repo, only for me to remember about the global one.<p>It catches <i>others</i> out (or catches me out by their doing) in collaboration when say I&#x27;ve not committed something, not even really been aware of the potential hazard, and that&#x27;s been desired; but then someone else comes along and `git commit -a`s it.<p>But then where it is particularly useful is myriad tools that fall back on git ignore in lieu of (or in addition to) their own ignore files...
  • chmaynard1 hour ago
    For a deeper dive on git ignore files, see:<p><a href="https:&#x2F;&#x2F;nesbitt.io&#x2F;2026&#x2F;02&#x2F;12&#x2F;the-many-flavors-of-ignore-files.html" rel="nofollow">https:&#x2F;&#x2F;nesbitt.io&#x2F;2026&#x2F;02&#x2F;12&#x2F;the-many-flavors-of-ignore-fil...</a>