If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.
If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.
If it's only needed for one particular checkout, .git/info/exclude is the other obvious option.
```.gitignore
# Ignores
## Unix hidden files
.*
## Temporary files and backups
*~
*.swp
*.bak
# Exceptions
!.ignore
!.gitignore
```
But I tend to copy it over and extend it as I go, and there's well-known reference gitignore files to skim for if you have anxiety around any particular language/editor/tool.Now, I could extend my user-global ignore, but there's no project where I want the state of the repo to be wrong, but my local state saving me unknowingly, as I know it'll bite others.
I'd add .nvmrc and .npmrc if you work with NodeJS.
I think rules for your personal tools, like editor-specific ignores belong to your user-level config, but anything around the project's tools and artifacts belongs in the project's gitignore.
Keys, npm directories and huge binaries are fixed by deleting them later on. The horror.
Yeah command line is cool and all but I do believe most of the developers should be using UI tooling where staging area is showing nice diffs.
Built in GIT handling in IDE usually is better than command line but also usually worse than dedicated tool like GitExtensions or SourceTree which are free and are super convenient for staging.
People don't know they don't have to stage whole files but they can stage hunks, well in command line it is too much hassle for me but in GUI tools it is no brainer.
I recommend looking here: https://git-scm.com/tools/guis
(it might be that you will be waaay cooler using GUI tool because you will be able to fix things others can't ... saying from my experience)
Fun fact: Jonas, the creator of tig, is an ex-colleague of mine. It’s cool working with people while using dev tools they wrote!
Plus, it's not the worst idea to exercise your "whoops we leaked our secrets" procedures. You do have procedures, right?
But I'm a little worried that solo developers might follow this device. And then not notice for weeks or months, losing large amounts of git history in the best case; Or potentially massive amounts of actual work if their original development folder is gone.
Not pushing a file has a much easier fix than pushing an API key. The damage is also very different.
Sure, both have failure modes but the effect of the failure is different and acting like they're the same isn't helpful to finding solutions
It's often said that you can't fix behavioral problems with technology, but I've found that tooling that strictly enforces rules is really useful.
I mean I do too, then git status to check what went it, then unstage files that aren't supposed to be there, rewrite .gitignore to exclude them (usually), and finally commit. Tends to be faster than manually adding each file/path. Alternatively, I start out with `git add -p` (interactive) and go through that workflow.
Like git rebase -i as well
Keys that are deleted are not gone from the git history. They’re still in the repo.
Same with giant blobs and binaries.
Maybe that's more ergonomic than forcing all users to learn about ~/.gitignore or manually adding .DS_Store *.sav~ et cetera into your Go project's repo's .gitignore.
Especially the humility it requires - remember being mad when my younger brother joined my Factorio game and changed smelters setup. To an actually better one - one thing when people correct your technical solutions, double so bad when they are actually right.
(disclaimer - this is my own tool)
[0] https://github.com/asamarts/alint [1] https://alint.org/docs/rules/git-hygiene/git_no_denied_paths...
Or even better, have a proper global gitignore file on your computer…
You clearly haven't seen the people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.
You see the issue right?
Adding extra, sensitive, files would not cause test failures, and even if they do (via secret scanners, etc), it is too late at that point because they will have already been shared upstream.
I am not sure the juice is worth the squeeze here, but it has some logic to it.
I’ve worked with and managed plenty of people like that and those are the people I least want doing something like this. Seeing the flotsam and jetsam of .DS_Store etc. are an early warning sign they aren’t paying any attention to what they push and the sooner that gets caught and addressed the better.
Pay attention to what you are committing. Generally this means looking at what you have staged before writing your commit log message.
Pay attention to what is in your pull request. Generally this means looking at your commits / draft pull request before you ask for code review.
If anybody other than you sees crap in your pull request that should obviously have been ignored, it means you have failed to pay attention to what you are doing three separate times.
> people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.
People? Even LLMs do thatDoing that on projects where I collaborate I would equate to pissing in public.
That is also why pull requests are such a great idea in general, because GIT allows one to piss in his own garden as much as they want.
Even if I could piss in my own branch I never do so when working on a project with other people.
I don't piss around my home obviously in case someone didn't get the metaphor.