this post was submitted on 20 Nov 2024
865 points (97.6% liked)
Programmer Humor
19623 readers
47 users here now
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
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
How do you view diffs and merges when you say you don't use git GUIs? External tool or terminal/command line?
I use Jetbrains IDEs and most of my life has been IDE based git interaction. And I honestly love it, easy access to see my diffs, the most common commit, push and stage(or shelve as Jetbrains does it, which is better than visual studio). Hassle free and available beats writing anything to me.
Terminal.
Perhaps, it is a mix of learned behaviour and cognitive fixation, as I started out my development journey predominantly using a terminal, that I cannot fathom Git GUI being hassle free.
Nice to read a different perspective on such a fundamental thing that I take for granted while working. Thank you for sharing it.
I asked about that for diffs, because I can't imagine using a terminal for this job. I don't mean any offense by it just to be clear, it's just not something that works for me. Perhaps I rely more on visual orgnaization. To give some context to that:
The standard way git shows up in a terminal (on Windows) it's diffuclt for me to "orient" myself in the code based on the diff, I prefer side by side diff compared to the split addition/deletion lines. I also like syntax highlighing that default git does not do.
Git in a Jetbrains IDE has the diff for any of my changed files is a single click away. The commit window has overview of changed files, a single click to view and edit a diff, including the normal syntax highlighting and one-click revert for a single change. Jetbrains specifically also avoid some of the bothersome part of pulling or checking out changes, as it doesn't force you to stash changes first.
Dealing with a merge conflict without a GUI also seems exessively hard. How do you do that through a terminal and keep track of things? Especially if it is a really messy conflict?
I am not sure how to articulate the answer to this question, as it just feels intuitive. It is how I learned and used it, and it would be akin to describing how I see colours. I am sure I would have found it a pain at the beginning.
In the case of a messy merge conflict, it consumes a lot of time, which I am sure would be the case with GUIs too, but I never found Git on terminal getting in my way in such instances.
I can say that I prefer inline diff view, and find split diff views to be jarring. I am sure syntax highlighting can be enabled while viewing diffs on terminal. However, I never bothered enabling it, despite using it in my editors for as long as I can remember.
That sounds risky to me. But as long as it make sense to the user, and it always behaves deterministically, it is fine.
I remember trying out the Git GUI offered by CLion a few years back. I found the interactive way of viewing diffs a chore and time consuming. Perhaps, they have revamped the UX; I remember reading about a UI revamp across JetBrains' lineup a year or so back. If so, I will check it out again.
Thanks for the replies.
The stashing isn't as bad as it sounds, it keeps a copy around when swapping branch so even if you fuck it up, it should still be in storage. I think the worst one I had was popping from the shelf and it failed to apply but still got removed... I don't remember why that ended up happening but yeah. Not exactly related to the automatic stashing however. But I tend to more often want to keep changes changing branch than not. I have to use stash/Shelve less often because of it.
I know Jetbrains added a "all in one" diff option about a year ago, but I hate it as large/many files make it horribly slow and awful to navigate compared to just moving through the files one at a time. But the diff view itself good. I know there may be some that disagree, but it allows ignoring whitespace and newlines, which filters out non-important from important changes. For most programming (aka not python) whitespace changes means nothing so it doesn't matter 99% of the time. But it greatly improves going through a diff that had a total "code cleanup/reformat". Which is more often than one would expect in my project.
Ignoring whitespace can simplify diffs, but I prefer to keep it visible to see exactly how the code has changed.
I also try to minimize whitespace changes by relegating formatting adjustments to the final stage of a code check-in, after all approvals. It is even better when the project or team uses Git hooks with a linter and formatter to take away this rote work altogether.
Thank you too for sharing your workflow. It is always interesting to read how everyone approaches the same problem in their own way. :-)