mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
Add Ignore Files Specific To Your Workflow as a git til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||
|
||||
_1058 TILs and counting..._
|
||||
_1059 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -244,6 +244,7 @@ _1058 TILs and counting..._
|
||||
- [Grep For A Pattern On Another Branch](git/grep-for-a-pattern-on-another-branch.md)
|
||||
- [Grep Over Commit Messages](git/grep-over-commit-messages.md)
|
||||
- [Ignore Changes To A Tracked File](git/ignore-changes-to-a-tracked-file.md)
|
||||
- [Ignore Files Specific To Your Workflow](git/ignore-files-specific-to-your-workflow.md)
|
||||
- [Include A Message With Your Stashed Changes](git/include-a-message-with-your-stashed-changes.md)
|
||||
- [Include Or Exclude Remaining Patch Changes](git/include-or-exclude-remaining-patch-changes.md)
|
||||
- [Include Some Stats In Your Git Log](git/include-some-stats-in-your-git-log.md)
|
||||
|
||||
31
git/ignore-files-specific-to-your-workflow.md
Normal file
31
git/ignore-files-specific-to-your-workflow.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Ignore Files Specific To Your Workflow
|
||||
|
||||
_If you want to watch instead of read, I explore this in [Four Ways to Ignore
|
||||
Files with Git](https://www.youtube.com/watch?v=ip06v7Wnfz0)._
|
||||
|
||||
The most common way to tell git to ignore files is to add them to a project's
|
||||
`.gitignore` file. This file is kept under version control, so it is shared
|
||||
with anyone who clones the project.
|
||||
|
||||
What about ignoring files that shouldn't necessarily be recorded in the
|
||||
project's `.gitignore`?
|
||||
|
||||
For instance, let's say I create a `notes.md` file to write some project notes
|
||||
to myself or keep track of a few todo items. This file is just for me. I don't
|
||||
want it committed. Because this `notes.md` is an idiosyncrasy of my workflow, I
|
||||
don't want to exclude it in the tracked `.gitignore` file.
|
||||
|
||||
Instead, this file is a perfect candidate for the git repository's
|
||||
`.git/info/exclude` file. Git treats entries in this file the same as it does
|
||||
the `.gitignore` file. This file only exists on my machine and is not under
|
||||
version control.
|
||||
|
||||
```
|
||||
# .git/info/exclude
|
||||
notes.md
|
||||
```
|
||||
|
||||
Once I've added that line, `notes.md` will no longer show up as an untracked
|
||||
file when I run `git status`.
|
||||
|
||||
See `man gitignore` for more details.
|
||||
Reference in New Issue
Block a user