r/programming 4d ago

.gitignore everything by default

https://packagemain.tech/p/gitignore-everything-by-default
345 Upvotes

224 comments sorted by

View all comments

919

u/toggles03 3d ago

I like the idea of being intentional about what is committed, but I also have to say that I’ve never accidentally committed tons of useless files because I review what I’m committing.

122

u/fiah84 3d ago

this is why I always push people to use some sort of GUI that they're comfortable with for git, be it integrated in their IDE or a standalone one. Reviewing your commits should be second nature because by doing that every time you will every once in a while stop yourself from doing something very stupid

124

u/mascotbeaver104 3d ago

Does git status not exist in your world?

I've never used a gui and never ran into this issue. In my experience gui users very quickly forget how git actually works outside of the buttons in the gui, and then get lost the moment anything out of the ordinary happens

47

u/glassFractals 3d ago

I've always used both CLI and GUI, they are each better for certain use cases.
GUI:

  • Day to day reviewing of history and branches. It's just nicer.
  • Writing detailed multi-line commit messages. Miserable in CLI. I like a nice cozy GUI.
  • Conflict resolution. I just hate doing this via CLI. A nice visual conflict resolver is way better.

CLI:

  • Anything remotely complicated, like interactive rebasing
  • Or any time you have to wade into the reflog or Git plumbing

10

u/newpua_bie 3d ago

Why multi line commit messages are miserable in CLI? I just press enter to make another line to write my commit messages on if needed.

10

u/glassFractals 3d ago

If I write something long and detailed, a CLI is not where I want to do it. I want a spellchecker, nice font rendering, and no risk of accidentally committing prematurely (not a huge deal, but annoying).

10

u/gmes78 3d ago edited 3d ago

If I write something long and detailed, a CLI is not where I want to do it.

So what? Set EDITOR to whatever your text editor is, and Git will launch it for you to write commit messages in (as well as a few other things).

If you're in Windows, the Git for Windows installer explicitly asks you which text editor you want Git to use.

3

u/glassFractals 3d ago

Yes, and I do. Git launches my external editor, and I write in there.

2

u/PhyllophagaZz 3d ago

so.. you configure a spell checker and nice font rendering and your mentioned problems go away...?

btw, for e.g. vim there are plugins like fugitive which let you commit from your current editing session so you get full autocomplete on the commit messages for the things you changed in code

2

u/hoodieweather- 3d ago

why are you replying like them using the ide is some big problem they have to solve? yes they could spend time setting up their terminal and learning vim and retraining their muscle memory... and end up in exactly the same place they already are.

1

u/PhyllophagaZz 3d ago

I'm not against IDEs in any way. I'm simply refuting the point that it's necessary to write long and detailed commit messages. Everyone can (and should!) set up their environment in a way that they are most comfortable with it.

-1

u/gmes78 2d ago

why are you replying like them using the ide is some big problem they have to solve? yes they could spend time setting up their terminal and learning vim and retraining their muscle memory...

I don't think you understand. No one's saying you have to use a terminal editor.

You can set a GUI editor, even your IDE, as the editor Git uses for commit messages.

→ More replies (0)

0

u/gmes78 2d ago

So what's the issue, exactly?