Live data from Hacker News

A Git client for simultaneous branches on top of your existing workflow

gitbutler.com

51–60 of 119 posts

Re: A Git client for simultaneous branches on top of your existing workflow

#51
post #45

Earlier quoted context omitted.

GitButler will literally not work when you use raw git, or other tools.

It works fine. The only thing that is a problem is “branch” and “commit”, things that use the index. But that makes sense. If you have setup two virtual branches and then from the cli run “git commit”, which branch do we commit to?

If it were implemented as a 'rebased chain' as I described rather than a multi-head merge: the active one, just as vanilla `git commit` would.

Re: A Git client for simultaneous branches on top of your existing workflow

#52
Slightly offtopic, but because this was prominently featured in their demo:

AI generated commit messages are horrible. I'm not opposed to them in principle, but currently every implementation I have seen uses the code change itself as the context to generate the message. This is just wrong. Commit messages are there to convey information that's explicitly not contained in the code itself and shouldn't just repeat or summarize the code changes (that's what the diff is for). They should contain the reason why the code change was made in the first place, approaches that were considered and did not make it into the code change, etc. Short everything that's not contained in the diff.

AI commit message generators incentivize people to write the wrong type of commit message.

Re: A Git client for simultaneous branches on top of your existing workflow

#53
post #38
post #30

Earlier quoted context omitted.

Im not following you. What do you mean by “don’t use other tooling”?

> Quick warning. You cannot use both GitButler virtual branches and normal Git branching commands at the same time, you will have to "commit" to one approach or the other. & see the description of 'the integration commit' for some detail of how they make it work: https://docs.gitbutler.com/features/virtual-branches/integra... Basically anything you do with `git` (or another GUI) will get blown away by GitButler; or i…

This limitation stems from the fact that GB introduces an additional dimension of versioning on top of Git. One way of thinking of what it does with virtual branches is like "multiplexing" multiple branches onto the same working directory. On the way out they get "demuxed" into plain git trees.

With that said, the tool is very cautious not to mess with any existing branches. This is the very reason it operates on a separate integration branch. Switching between the "special/integration" branch and any other branch is also not an issue.

Re: A Git client for simultaneous branches on top of your existing workflow

#54
post #48
post #38

Earlier quoted context omitted.

> Quick warning. You cannot use both GitButler virtual branches and normal Git branching commands at the same time, you will have to "commit" to one approach or the other. & see the description of 'the integration commit' for some detail of how they make it work: https://docs.gitbutler.com/features/virtual-branches/integra... Basically anything you do with `git` (or another GUI) will get blown away by GitButler; or i…

You can switch back and forth rather easily. But if you have multiple branches applied, some git commands wont make any sense.

Sorry I didn't realise you worked on GitButler when you asked.

> But if you have multiple branches applied, some git commands wont make any sense.

Sure, because of the way it's implemented. But that's just a variation on what I said really - I like the idea, see value in automating some management so that I can see & work on something that's the amalgamation of multiple branches, but I don't want to (have to) go 'all in' on some third-party tool, it needs to work like an extension of vanilla git for me, so everything else can keep working as normal.

It needs to be implemented in 2D so that git CLI can still understand, to put it in the docs' terms.

Re: A Git client for simultaneous branches on top of your existing workflow

#55

Not sure this is something I need. One thing I do need though, maybe someone knows a solution: Often I find myself maintaining a handful of "local" changes. I make some changes that only make sense in my local environment, that I don't want to push. What I end up doing is maintaining these changes as a commit, committing on top of them, and using `git rebase -i` to periodically move them up. Then before I push, I hav…

> Then before I push, I have to temporarily rewind the branch to remove them, push, then cherry-pick them again.

You do not necessarily need to modify and restore your branch head just to push in this case. If you have e.g. two temporary commits at the top of the branch, you can use e.g. "git push origin HEAD~2:master" to skip those commits when pushing.

Re: A Git client for simultaneous branches on top of your existing workflow

#56
post #45

Earlier quoted context omitted.

GitButler will literally not work when you use raw git, or other tools.

It works fine. The only thing that is a problem is “branch” and “commit”, things that use the index. But that makes sense. If you have setup two virtual branches and then from the cli run “git commit”, which branch do we commit to?

This makes sense, but I have to say I would find it much less concerning if doing "commit" would apply to some well-defined selection. Either something marked in the UI as "default" or "first" or something so that normal git operations wouldn't cause failure. I realize it makes one of the virtuals special, which is unfortunate, but it means normal command line workflows would be _safe_ even if they wouldn't always provide all the options.

Re: A Git client for simultaneous branches on top of your existing workflow

#57
post #53
post #38

Earlier quoted context omitted.

> Quick warning. You cannot use both GitButler virtual branches and normal Git branching commands at the same time, you will have to "commit" to one approach or the other. & see the description of 'the integration commit' for some detail of how they make it work: https://docs.gitbutler.com/features/virtual-branches/integra... Basically anything you do with `git` (or another GUI) will get blown away by GitButler; or i…

This limitation stems from the fact that GB introduces an additional dimension of versioning on top of Git. One way of thinking of what it does with virtual branches is like "multiplexing" multiple branches onto the same working directory. On the way out they get "demuxed" into plain git trees. With that said, the tool is very cautious not to mess with any existing branches. This is the very reason it operates on a s…

Maybe the problem is that the docs aren't selling me anything that I don't currently achieve by (manually) rebasing? So I'm left thinking I'd rather stick with my current workflow (or maybe motivated to alias it up a bit more) than adopt this limitation.

Re: A Git client for simultaneous branches on top of your existing workflow

#58

Not sure this is something I need. One thing I do need though, maybe someone knows a solution: Often I find myself maintaining a handful of "local" changes. I make some changes that only make sense in my local environment, that I don't want to push. What I end up doing is maintaining these changes as a commit, committing on top of them, and using `git rebase -i` to periodically move them up. Then before I push, I hav…

I have the same problem, but I haven't found a convenient solution yet.

Though stated differently, it's exactly the same thing: https://stackoverflow.com/questions/76717374/how-do-i-keep-a...

A somewhat related but inexact match is when you want to ignore changes to some files (e.g. I sometimes vary some test code locally and don't really want that to be exposed to others) for which I found a convenient fix on SO and compiled into an answer https://stackoverflow.com/a/70075113/3858681

Re: A Git client for simultaneous branches on top of your existing workflow

#59
post #54
post #48

Earlier quoted context omitted.

You can switch back and forth rather easily. But if you have multiple branches applied, some git commands wont make any sense.

Sorry I didn't realise you worked on GitButler when you asked. > But if you have multiple branches applied, some git commands wont make any sense. Sure, because of the way it's implemented. But that's just a variation on what I said really - I like the idea, see value in automating some management so that I can see & work on something that's the amalgamation of multiple branches, but I don't want to (have to) go 'all…

Just to clarify, yes, in order to work on multiple simultaneous branches, you need a tool that knows what that means, which git does not really. But you can also very easily run 'git checkout main' and do whatever and then go back to GitButler and restore state. It's pretty good at knowing what mode you're in.

Basically all your virtual branches also live in refs/gitbutler/[name] and GB won't touch stuff in refs/heads/ because we like the idea of making sure we're not clobbering things you don't expect us to. You can just think of GitButler as a tool for managing refs/gitbutler branches.

All git tooling work totally fine, even generally if you're using something (like commit) that doesn't really make sense in the context of multiple branches.

Re: A Git client for simultaneous branches on top of your existing workflow

#60

Not sure this is something I need. One thing I do need though, maybe someone knows a solution: Often I find myself maintaining a handful of "local" changes. I make some changes that only make sense in my local environment, that I don't want to push. What I end up doing is maintaining these changes as a commit, committing on top of them, and using `git rebase -i` to periodically move them up. Then before I push, I hav…

I think this tool would help that, because you'd stick your only-makes-sense-for-you changes on `my-eyes-only` branch; that branch would always be in your 'integration' commit, along with whatever other 1+ branch(es) you were working, and you'd just only push the latter.

That said even without GitButler you can improve it a bit: you can `git push HEAD^:` rather than 'temporarily rewinding the branch to remove them'. You could also consider just never committing it, stashing the changes if you really needed them out of the worktree, and if they're whole new files adding to `.gitignore`.

Post reply on HN