deadbeef79000 48 points a day ago

Nonono. This makes sense.

It ignores all other gitignore files in all subdirectories.

It would be one way to enforce concentrating all ignores into this file (or its ancestors).

path: 0 26273734, hotness: undefined, score: 48, children: 10
Ephera 22 points a day ago

Had a quick playaround with it:

  • Yes, that does prevent gitignore files from being committed.
  • It does not prevent locally-created gitignore files from being applied.

But I'd say the latter is overall a good thing, as some build tools will do a echo "*" > build/.gitignore to have their build-folder add itself to the ignore-list.

path: 0 26273734 26274012, hotness: undefined, score: 22, children: 9
deadbeef79000 12 points a day ago

Ooh, uncomittable files are still honoured. That's mildly interesting, I can see it being both useful and maddening.

path: 0 26273734 26274012 26274604, hotness: undefined, score: 12, children: 3
Traister101 16 points a day ago

Git ignore doesn't prevent things from being committed it just prevents them from being "tracked" (for lack of a better word) by default. If you manually explicitly add the file to a commit, and then commit the file will be tracked despite matching the ignore

path: 0 26273734 26274012 26274604 26275148, hotness: undefined, score: 16, children: 1
deadbeef79000 3 points a day ago

Yeah, poorly worded on my part.

path: 0 26273734 26274012 26274604 26275148 26276892, hotness: undefined, score: 3, children: 0
Valmond 3 points a day ago

You can always have local ignore files too (like for your personal IDE or whatever)

path: 0 26273734 26274012 26274604 26278328, hotness: undefined, score: 3, children: 0
NotSteve_ 4 points a day ago

What's the benefit of scripting the wildcard gitignore over just adding build/ to the root gitignore? I guess being build directory name agnostic?

path: 0 26273734 26274012 26274153, hotness: undefined, score: 4, children: 1
Ephera 3 points a day ago

Well, if you're the build tool that creates that build-folder, then it just means you don't need to bother your user with adding it to the root gitignore.

One time, I implemented it for basically a repo-specific download cache folder. Ideally, my users don't need to know of that folder at all.

Or recently, I implemented it for a build tool where my users might not be devs. They might not use Git at all, or not be very adept at it, so I'm glad to not need to document it...

path: 0 26273734 26274012 26274153 26274261, hotness: undefined, score: 3, children: 0
otter 2 points a day ago

Does it prevent the initial .gitignore from being commited too?

For example, what if a file name had sensitive information. It's bad practice, but someone might want to ignore the file while also hiding the ignore rule itself.

/test/fake-person-first-last.json
/test/real-person-first-last.json

Someone might want to selectively omit the second file while keeping the first, but not show what they are hiding.

path: 0 26273734 26274012 26274507, hotness: undefined, score: 2, children: 2
firelizzard 5 points a day ago

.gitignore doesn’t prevent things from being committed. It just tells git to ignore files that aren’t already being tracked. And you can easily override that with -f. Putting .gitignore inside of .gitignore will ignore itself (if it’s not already tracked).

path: 0 26273734 26274012 26274507 26275777, hotness: undefined, score: 5, children: 0
Ephera 4 points a day ago

If you're an end user, not a build tool, you'd rather want to place that in .git/info/exclude inside the repo. It's effectively another gitignore file, which won't be committed.

But if you do need something like this for a build tool, then yeah, you can create a file /test/.gitignore with these contents:

real-person-first-last.json
.gitignore

Then running git add . just adds /test/fake-person-first-last.json.

Both /test/.gitignore and /test/real-person-first-last.json would be ignored right away.

path: 0 26273734 26274012 26274507 26275736, hotness: undefined, score: 4, children: 0
LeapSecond 14 points a day ago

FYI there is a command to ignore specific files locally: git update-index --skip-worktree <file_name> from here. And you can later unignore it with --no-skip-worktree

path: 0 26275991, hotness: undefined, score: 14, children: 0
someacnt_ 13 points a day ago

Out of curiousity, I searched about it. Turned out, there were actually people who wanted to ignore the gitignore file. https://stackoverflow.com/...

path: 0 26273979, hotness: undefined, score: 13, children: 1
marcos 7 points a day ago

Some teams use the same tools with the same configurations so they can get each other's code immediately.

Other teams solve the problem of how to just send or get the parts that work, and leave everybody do whatever.

path: 0 26273979 26274134, hotness: undefined, score: 7, children: 0
ransomwarelettuce 8 points a day ago

funnily enough I did that and sometimes do in some projects in order to locally not commit IDE stuff or test folders.

if I want to update the .gitignore in such cases I test local and change in the remote.

path: 0 26275558, hotness: undefined, score: 8, children: 0
fubarx 4 points a day ago

path: 0 26274474, hotness: undefined, score: 4, children: 0
programmer_humor
programmer_humor

@programming.dev

login for more options
33571
2550
7101

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn't find it funny, you're banned. Ha-ha!... For real: do not use the community for "statements". There are other places for such content. Keep it chill and funny.

go to feed...