Last active
September 4, 2025 23:38
-
Star
(571)
You must be signed in to star a gist -
Fork
(76)
You must be signed in to fork a gist
-
-
Save subfuzion/db7f57fff2fb6998a16c to your computer and use it in GitHub Desktop.
Revisions
-
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,4 +79,17 @@ Or edit settings directly: ```text "search.useIgnoreFiles": true, "search.useGlobalIgnoreFiles": true ``` ## Final notes If you want to exclude files on a per-repo basis without modifying `.gitignore`, you can directly edit `.git/info/exclude` in the repo. Nothing under the local `.git` directory is committed. I find myself often creating "scratch" code that I don't want to commit. I do this enough that I found it useful to add `scratch/` to my global ignore. I've personally never worked on a project where this is an issue because a directory called `scratch` should not be a ignored, but if this is a concern, try using `__scratch__` or something similar. You might find useful ignore patterns for your projects here on GitHub: https://github.com/github/gitignore -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,8 @@ Particularly for Windows users, verify any filename was correctly parsed for quo #### Isn't there already a default global ignore? Depending on your system, and whether the `XDG_CONFIG_HOME` environment variable is set, there might be a default location and there might actually be a file at that location. The best practice is to ensure the file exists where you want and explicitly tell git about it using `git config --global core.excludesFile`. ## Global .gitignore contents -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,19 @@ There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's `.gitignore` is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the `node_modules` directory) as well as files that are generated (and regenerated) as artifacts of a build process. All other files should be in your own global gitignore file: - Create a file called `.gitignore` in your home directory and add any filepath patterns you want to ignore. - Tell git where your global gitignore file is. > Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. > You could substitute `.config/git/ignore` for `.gitignore` in your home directory, if you prefer. #### Mac git config --global core.excludesfile ~/.gitignore #### Windows git config --global core.excludesfile "%USERPROFILE%\.gitignore" If using Powershell (credit: @kupmanj): @@ -23,10 +26,13 @@ This will result in an entry in your .gitconfig that looks like this: excludesfile = {path-to-home-dir}/.gitignore #### Confirm location Particularly for Windows users, verify any filename was correctly parsed for quotes and expansion: git config --global core.excludesFile #### Isn't there already a default global ignore? Depending on your system, and whether the `XDG_CONFIG_HOME` environment variable is set, there might be a default location and there might actually be a file at that location. The safest thing @@ -58,10 +64,13 @@ log/ ``` ## Visual Studio Code If you want search to ignore files that you've set in your local `.gitignore`, you must check: - Search: Use Ignore Files If you want search to ignore files that you've set in your global ignore, you must **also** check this: - Search: Use Global Ignore Files Or edit settings directly: -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,8 @@ All other files should be in your own global gitignore file: #### Windows git config --global core.excludesfile "%USERPROFILE%\.gitignore" If using Powershell (credit: @kupmanj): git config --global core.excludesFile "$Env:USERPROFILE\.gitignore" This will result in an entry in your .gitconfig that looks like this: -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 10 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,12 +56,16 @@ log/ # etc... ``` ## Visual Studio Code If you want search to ignore files that you've set in your local `.gitignore`, you must check: - Search: Use Ignore Files If you want search to ignore files that you've set in your global ignore, you must **also** check this: - Search: Use Global Ignore Files Or edit settings directly: ```text "search.useIgnoreFiles": true, "search.useGlobalIgnoreFiles": true ``` -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,34 @@ There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's `.gitignore` is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the `node_modules` directory) as well as files that are generated (and regenerated) as artifacts of a build process. All other files should be in your own global gitignore file: - Create a file called `.gitignore` in your home directory and add any filepath patterns you want to ignore. - Tell git where your global gitignore file is. > The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could > substitute `.config/git/ignore` for `.gitignore` in your home directory, if you prefer. #### Mac git config --global core.excludesfile ~/.gitignore #### Windows git config --global core.excludesfile "%USERPROFILE%\.gitignore" Or, for Powershell (credit: @kupmanj): git config --global core.excludesFile "$Env:USERPROFILE\.gitignore" This will result in an entry in your .gitconfig that looks like this: [core] excludesfile = {path-to-home-dir}/.gitignore #### Confirm location Particularly for Windows users, verify any filename was correctly parsed for quotes and expansion: git config --global core.excludesFile #### Isn't there already a default global ignore? Depending on your system, and whether the `XDG_CONFIG_HOME` environment variable is set, there might be a default location and there might actually be a file at that location. The safest thing ## Global .gitignore contents Depending on your OS and tools, the following contains sample of what you might want to include. When you run `git status` before adding any files to your local repo, check to see if any files don't belong. Add them to your global gitignore as appropriate. -
subfuzion revised this gist
Aug 11, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ All other files should be in your own global gitignore file. Create a file calle git config --global core.excludesfile ~/.gitignore #### Windows git config --global core.excludesfile "%USERPROFILE%\.gitignore" This will result in an entry in your .gitconfig that looks like this: -
tonypujals created this gist
Dec 19, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's `.gitignore` is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the `node_modules` directory) as well as files that are generated (and regenerated) as artifacts of a build process. All other files should be in your own global gitignore file. Create a file called `.gitignore` in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is. #### Mac git config --global core.excludesfile ~/.gitignore #### Windows git config --global core.excludesfile %USERPROFILE%\.gitignore This will result in an entry in your .gitconfig that looks like this: [core] excludesfile = {path-to-home-dir}/.gitignore ## Global .gitignore contents Depending on your OS and tools, the following contains sample of what you might want to include. When you run `git status` before adding any files to your local repo, check to see if any files don't belong. Add them to your global gitignore as appropriate. ``` # Node npm-debug.log # Mac .DS_Store # Windows Thumbs.db # WebStorm .idea/ # vi *~ # General log/ *.log # etc... ``` ## WebStorm If you use WebStorm, you will also need to copy your global gitignore contents to its Ignored Files dialog. #### Mac WebStorm | Preferences | Version Control | Ignored Files #### Windows File | Settings | Version Control | Ignored Files