gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Easy Trunk branch change

Open gitbutler-client opened this issue 1 year ago • 8 comments

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

gitbutler-client avatar Jan 09 '24 15:01 gitbutler-client

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.

schacon avatar Jan 11 '24 12:01 schacon

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 😖

guyzmo avatar Mar 11 '24 16:03 guyzmo

@schacon what is the work-around ?

monaye avatar Apr 03 '24 17:04 monaye

@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).

MHHenriksen avatar Jun 20 '24 16:06 MHHenriksen

@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?).

koppor avatar Jun 24 '24 20:06 koppor

@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.

MHHenriksen avatar Jun 25 '24 04:06 MHHenriksen

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.

koppor avatar Jul 02 '24 15:07 koppor

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?

Caleb-T-Owens avatar Aug 15 '24 12:08 Caleb-T-Owens