this post was submitted on 11 Feb 2024
55 points (93.7% liked)

Programming

17398 readers
94 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
all 24 comments
sorted by: hot top controversial new old
[–] QuazarOmega@lemy.lol 52 points 9 months ago (1 children)
[–] LazaroFilm@lemmy.world 7 points 9 months ago (3 children)

They should make it in Rust.

[–] TheCommieAxolotl@programming.dev 8 points 9 months ago (1 children)

I actually did consider rewriting it to use Tauri over electron, but found it didn't fit to my pipeline or offered everything I needed,

[–] QuazarOmega@lemy.lol 1 points 9 months ago

That's fair honestly, also I dig that it's made in Solid!

[–] QuazarOmega@lemy.lol 3 points 9 months ago

Based rustacean

[–] dinckelman@lemmy.world 8 points 9 months ago (1 children)

This reminds me a lot of Gitkraken. Vast majority of the time git cli is enough, but for that rare situation when an operation is too complex, the gui was very convenient. Shame they nickel and dime you on everything now

[–] technom@programming.dev 24 points 9 months ago* (last edited 9 months ago) (1 children)

Funny. I have the opposite experience with git. Use GUI for simple tasks and drop to CLI when it's complicated or when something goes wrong.

[–] killeronthecorner@lemmy.world 6 points 9 months ago* (last edited 9 months ago) (2 children)

Same. I mostly use sourcetree to do quick self-reviews and to discard lines or hunks before a commit.

But I've also grown very weary of having to dig people out of git messes they've made with sourcetree and the likes.

Visual clients aren't to blame for that, but they contribute. So many times I've asked "and what git commands did that run?" only to receive a dumb stare as a reply.

[–] dinckelman@lemmy.world 4 points 9 months ago (1 children)

Not entirely unexpected. If you don't know what you're doing, a GUI will only accelerate the path between you and the wrong result, because these tend to abstract things too much at times

[–] killeronthecorner@lemmy.world 5 points 9 months ago (3 children)

Agreed. I've been trying to explain to someone recently why rebasing and force pushing their feature branch has no benefit when we use a squash commit strategy for merging to main.

Again, tools are not blame, but when combined with a lack of understanding and accumulated "git dogma", it can be quite disheartening.

[–] dinckelman@lemmy.world 5 points 9 months ago

I had a really sad eye-opener at university, in my third year. We had a lecture where they tried to explain what version control is, and the entire 300-something person class just said fuck it. These people honestly think that copying code to USB sticks and gDrive is easier than learning 4 commands, and a git frontend

[–] technom@programming.dev 2 points 9 months ago

I had the fortune of being the trainer for my company in all things git. I made sure that my colleagues (most of whom were straight out of universities) were introduced to git CLI and git concepts. No git GUIs were introduced. Consequently, the mess they made was easy to rectify. And then I occasionally read about horror stories like these where GUIs are allowed.

[–] AnActOfCreation@programming.dev 2 points 9 months ago (1 children)

I've been trying to explain to someone recently why rebasing and force pushing their feature branch has no benefit when we use a squash commit strategy for merging to main.

While you're 100% right, is there anything wrong with this approach? Sometimes I like to keep by personal branches clean, especially before I open a PR.

[–] killeronthecorner@lemmy.world 3 points 9 months ago

It depends on your intent. If you're doing it to keep history clean and linear in the long term, it's a huge waste of time as it gets splatted into a single squashed merge commit. It also makes it difficult for reviewers to rereview your changes as GitHub/Lab can't calculate the diff because you keep moving the goalposts with force pushes.

If you're doing it for cleanliness on your local branch then I guess that's fine, but I find it anti-social in a multi participant repo.

[–] pycorax@lemmy.world 2 points 9 months ago

I found SourceTree to be especially bad at this. For the inexperienced, I think Fork is a lot better. It also helps that you can inspect the commands that were executed by it.

[–] BrianTheeBiscuiteer@lemmy.world 3 points 9 months ago (3 children)

Does this help with rebasing? I rarely have a need to rebase but all the same I avoid it because I just don't get it.

[–] Oszilloraptor@feddit.de 4 points 9 months ago (1 children)

How you could somewhat rebase manually (to understand the effect; or because you like to handle the merge conflicts more granular or be more selective):

We assume we have the branch "Feat" which was started on an old version of "Main", and now want to rebase it:

  • Rename "Feat" to "Old" (does not happen during rebase, but we kinda need it for this demonstration)
  • Create "Feat" at the newest (or wherever you want) commit of "Main"
  • Cherrypick all commits from "Old" into "Feat"

Et viola - you kinda manually rebased "Feat" on "Main"

[–] BrianTheeBiscuiteer@lemmy.world 2 points 9 months ago (1 children)

Unless you really hate the commits that say "merged branch X into Y" I never saw rebasing as any easier than merging.

[–] Traister101@lemmy.today 1 points 9 months ago

Rebasing shines for local commits not remote commits. IE rebase your commits onto the remote or amend the previous commit (yes that's actually a rebase)

[–] TheCommieAxolotl@programming.dev 2 points 9 months ago

Not currently but it is planned to be added soon along with in-client conflict resolution.

[–] QuadriLiteral@programming.dev 1 points 9 months ago (1 children)

Rebasing is basically copy/paste of commits. I do it all the time, to keep a feature branch updated with develop for instance.

[–] BrianTheeBiscuiteer@lemmy.world 1 points 9 months ago (1 children)

I normally just do a merge and resolve the conflicts.

[–] ValurianEwan@midwest.social 1 points 9 months ago

Handling conflicts in a merge will have them applied in a Merge commit (the only time a commit can have two parents).

Handling conflicts via a rebase will cascade across the replayed (copied) commits from which you're restarting onto the new base commit, individually. You will not have a Merge commit, each commit will have a single parent.

Reasons to perform a rebase. When your branch is to be temporary, when you want to be able to find a problem from commit to commit via a bisect, or when the total number of commits with expected conflicts is low.

Reasons to perform a merge. When you have two long running branches and you want to track the history of a single commit. For example when you have a release that you have tagged and you need a hotfix. You apply the fix to your release and then merge it into your mainline. So that you have historical reference of what was deployed when.

When is it fuzzy to use rebases vs merges. Working with others. You can rebase your local branch (and push your fast-forward merge), but not the shared branch. This changes the "history" (even when there are copies). Merges are most often the best tool when you are working with a shared branch.

I just brought up another merge, Fast-Forward merge. In git, branches are essentially a file with a commit in it. Every commit has a parent, with one exception, the first one. So long you have one commit, you can traverse the entire history up to that commit. So when your branch or remote has a commit that exists in the history of the target branch and you want to perform a merge it is called a Fast-Forward merge because you are simply updating the commit in that file to the commit that is newer. If there is a commit in a branch that does not exist one of the two branches, you will see an error and you will need to perform a Merge commit or a rebase.

There is also Squash merge, which collapses all commits into a single commit into a target branch. You will lose the history, but that may not be important (such as a Pull Request) where the history is not relevant (this is what we do at my workplace). When using a Squash merge, it will not matter if you use a Merge commit or a Rebase since it all just disappears (except the changes).