1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-14 20:48:01 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
jbranchaud
8d8e197048 Add Install Command Runs For Entire Workspace as a pnpm TIL 2022-10-01 11:19:13 -05:00
jbranchaud
d72ce5407a Remove trailing whitespace 2022-10-01 11:12:52 -05:00
jbranchaud
9e7f0221b9 Add Add A Range Of Filenames To gitignore as a Git TIL 2022-10-01 11:09:29 -05:00
3 changed files with 51 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1247 TILs and counting..._
_1249 TILs and counting..._
---
@@ -235,6 +235,7 @@ _1247 TILs and counting..._
### Git
- [Accessing a Lost Commit](git/accessing-a-lost-commit.md)
- [Add A Range Of Filename To gitignore](git/add-a-range-of-filenames-to-gitignore.md)
- [Amend Author Of Previous Commit](git/amend-author-of-previous-commit.md)
- [Auto-Squash Those Fixup Commits](git/auto-squash-those-fixup-commits.md)
- [Caching Credentials](git/caching-credentials.md)
@@ -309,7 +310,7 @@ _1247 TILs and counting..._
- [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md)
- [Skip A Bad Commit When Bisecting](git/skip-a-bad-commit-when-bisecting.md)
- [Skip Pre-Commit Hooks](git/skip-pre-commit-hooks.md)
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
- [Staging Stashes Interactively](git/staging-stashes-interactively.md)
- [Stash A Single Untracked File](git/stash-a-single-untracked-file.md)
- [Stash Everything](git/stash-everything.md)
@@ -556,6 +557,7 @@ _1247 TILs and counting..._
### pnpm
- [Execute A Command From The Workspace Root](pnpm/execute-a-command-from-the-workspace-root.md)
- [Install Command Runs For Entire Workspace](pnpm/install-command-runs-for-entire-workspace.md)
### PostgreSQL

View File

@@ -0,0 +1,34 @@
# Add A Range Of Filenames To gitignore
The `.gitignore` file is a file where you can list files that should be ignored
by git. This will prevent them from showing up in diffs, `git status`, etc.
Most entries in the `.gitignore` file will plainly correspond to a single file.
```
# ignore env var files
.env
.env.local
```
Sometimes a project has a bunch of similarly named files. Autogenerated files
are a prime example. For instance, a web app project may contain several
sitemap files with incrementing suffix values (i.e. `sitemap-1.xml`,
`sitemap-2.xml`, `sitemap-3.xml`, ...).
I'd like to avoid having to type those all out in my `.gitignore` file. And I
don't want to have to add new entries whenever another increment of the file is
generated.
I can handle all the current ones and future ones in a single line using some
range pattern matching supported by the `.gitignore` file format.
```
# ignore sitemap files
public/sitemap-[1-99].xml
```
This will ignore any sitemap files suffixed with 1 to 99. I don't really expect
there to ever be more than handful of those files, so _99_ should definitely do
the trick.
[source](https://www.golinuxcloud.com/gitignore-examples/#5_Examples_of_pattern_matching_in_gitignore)

View File

@@ -0,0 +1,13 @@
# Install Command Runs For Entire Workspace
When you run [`pnpm install`](https://pnpm.io/cli/install) in a monorepo, it
will run from the context of the workspace root. That means it will install
dependencies for your entire monorepo across apps and packages.
Even if you are in a subdirectory for a specific project with its own
`package.json`, running `pnpm install` will install dependencies for the entire
workspace.
If you want to install dependencies only for a specific project or a subset of
projects, you can use [the `--filter`
flag](https://pnpm.io/cli/install#--filter-package_selector).