gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
13.14k stars 520 forks source link

Easy Trunk branch change #2507

Open gitbutler-client opened 9 months ago

gitbutler-client commented 9 months ago

I would like to change the trunk branch without the need to re-import the project

via @koppor

https://discord.com/channels/1060193121130000425/1176875943873232947/1193874541164908544

schacon commented 9 months ago

This is on our short/medium term list. It's been a known issue for a while, but since it's work-aroundable and somewhat rare, we keep punting it.

guyzmo commented 7 months ago

Hello, and thank you for the project, it's awesome ❤️

Though, I did not know that was possible and I've tried to do my changes with multiple vbranches together, but now I'm having a hard time reconciling my commits 😖

monaye commented 7 months ago

@schacon what is the work-around ?

MHHenriksen commented 4 months ago

@schacon what is the work-around ?

I assume it's re-importing the project.

I can point out a real world scenario where this feature would be valuable: Maintenance branches. I work with broadcast software that gets installed on-premise for each customer, and our customers are very change-averse. Any major update has considerable risk and cost just from bureaucracy, which leads to customers staying on known working versions as long as they can, and we have to maintain these versions for long periods. Thus we have one branch for each major version still under support in addition to a main branch (e.g. v7.2, v8.0, v8.1 and main).

If I pick main as the trunk branch, I can't do anything with the maintenance branches because GitButler automatically merges the trunk into any applied branch, which we obviously don't want.

For certain internal reasons, we do not merge forward between these branches (otherwise I could just have selected the oldest maintained version as the GitButler Trunk and "apply" the other branches in order).

So my current options are either the aforementioned workaround of re-importing the project every time I need to target a different release, or have one clone per version (wasting a lot of disk space and time replicating changes to each copy since the project is quite large).

koppor commented 4 months ago

@MHHenriksen I fully agree. I would also like to have gitbutler working in parallel to "normal" branches. I am thinking of gh pr checkout 999, which checks out a pull request by a contributor. After that, GitButler complains

or have one clone per version (wasting a lot of disk space and time replicating changes to each copy since the project is quite large).

There is the cool worktree feature of git. A truly hidden gem. You can add more than one checkout. I don't know if GitBulter works with this, but I wanted to share, maybe its useful for you also in other contexts... -- Second thing: One can also clone locally. When doing on Linux, there is not any more disk space, because symbolic links are used (aren't they?).

MHHenriksen commented 4 months ago

@koppor Thanks for the tips! I did know about worktrees and have used them, which helps, but haven't actually tried it with GitButler. But I suspect the virtual branches might collide, since there's only one shared .git folder. And alas, these are Windows projects.

koppor commented 4 months ago

Another motivation to have GitButler supporting multiple branches: gh pr checkout #: When pull requests of external contributors need to be checked, these branches need a check out for "proper" try out and send review comments.

Caleb-T-Owens commented 2 months ago
Screenshot 2024-08-15 at 14 17 39

We now have an experimental setting which you can use to change the trunk branch whist you have no branches applied.

@krlvi should we close this issue, or do you want to wait till we have moved it out of experimental mode?