Skip to content

Fix branch syncing bug around git town propose --stack command#5973

Merged
kevgo merged 1 commit intogit-town:mainfrom
meowsus:fix/propose-stack
Jan 15, 2026
Merged

Fix branch syncing bug around git town propose --stack command#5973
kevgo merged 1 commit intogit-town:mainfrom
meowsus:fix/propose-stack

Conversation

@meowsus
Copy link
Contributor

@meowsus meowsus commented Jan 14, 2026

Hey @kevgo! I finally got a second to attempt to fix the issue I reported here: #5865 (and that you helped fix here). Turns out it was just an OOO issue, but I added a test case to prove to myself that it was actually happening. Give it a whirl and let me know what you think :)

@meowsus meowsus requested a review from kevgo as a code owner January 14, 2026 14:43
@kevgo
Copy link
Contributor

kevgo commented Jan 15, 2026

Thanks for fixing this, @meowsus! 🙏 Yep, the fix itself is pretty straightforward: when running git town propose --stack, Git Town should first check out the branch being proposed, then create the proposal.

I was planning to land the new proposal-creation test framework before addressing this bug, but you beat me to it, which is excellent news 🙂

The test failures happen because a few other end-to-end tests now also check out the branch before proposing it, so they'll need to be updated to match the new behavior. You can run make cuke to see the test failures on your machine.

prog.Value.Add(&opcodes.BranchTrackingCreateIfNeeded{
CurrentBranch: branchToPropose.name,
})
prog.Value.Add(&opcodes.CheckoutIfNeeded{Branch: branchToPropose.name})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of the CheckoutIfNeeded opcode here! This avoids unnecessary checkouts when the branch is already active

@meowsus
Copy link
Contributor Author

meowsus commented Jan 15, 2026

Awesome that this bug is valid. Yesterday I used stack proposals twice and the bug didn't manifest itself, which caused me to second guess this bugfix. I thought that maybe I hadn't been upgraded to the latest version (v22.4.0) before when I last saw it, but I remembered that I started seeing the prompt to run git town skip, which was the prompt added in that version.

I'm updating the tests now :)

@meowsus meowsus force-pushed the fix/propose-stack branch 2 times, most recently from 7f306a3 to 6c67ca8 Compare January 15, 2026 16:28
@kevgo kevgo merged commit d857431 into git-town:main Jan 15, 2026
5 checks passed
@kevgo
Copy link
Contributor

kevgo commented Jan 15, 2026

Thanks so much for fixing this! 👍

@meowsus
Copy link
Contributor Author

meowsus commented Jan 16, 2026

Thanks so much for making the only viable, free, and open-source alternative to Graphite, in my opinion!

@kevgo
Copy link
Contributor

kevgo commented Jan 26, 2026

This is available in v22.5.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 27, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [git-town/git-town](https://github.com/git-town/git-town) | minor | `v22.4.0` → `v22.5.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>git-town/git-town (git-town/git-town)</summary>

### [`v22.5.0`](https://github.com/git-town/git-town/releases/tag/v22.5.0)

[Compare Source](git-town/git-town@v22.4.0...v22.5.0)

##### New Features

- The Git Town CLI can now embed breadcrumbs in proposals. This helps reviewers understand where a branch sits in a stack. Enable it via the new `proposal-breadcrumb` setting and choose between `stacks` or `branches` ([docs](https://www.git-town.com/preferences/proposal-breadcrumb.html), [#&#8203;3003](git-town/git-town#3003)).
- Added `git-town commit`, a new command that lets you commit changes from your current branch directly into an ancestor branch and then syncs those changes back into your current branch. This makes it much easier to work on complex, cross-cutting changes in one place while committing each part to the correct branch in your stack ([#&#8203;5760](git-town/git-town#5760)).

##### Bug Fixes

- Fixed `git-town detach` to correctly handle branches with multiple children ([#&#8203;5988](git-town/git-town#5988)).
- Fixed `git-town propose --stack` to properly sync branches before proposing ([#&#8203;5973](git-town/git-town#5973)).

##### Contribution branches

Huge thanks to [@&#8203;AlexanderCiridae](https://github.com/AlexanderCiridae), [@&#8203;JaredSharplin](https://github.com/JaredSharplin), [@&#8203;ceilfors](https://github.com/ceilfors), [@&#8203;cjol](https://github.com/cjol), [@&#8203;davidolrik](https://github.com/davidolrik), [@&#8203;haltcase](https://github.com/haltcase), [@&#8203;kevgo](https://github.com/kevgo), [@&#8203;meowsus](https://github.com/meowsus), [@&#8203;mrmarufpro](https://github.com/mrmarufpro), [@&#8203;mw00120](https://github.com/mw00120), [@&#8203;nemith](https://github.com/nemith), [@&#8203;oleg-codaio](https://github.com/oleg-codaio), [@&#8203;ruudk](https://github.com/ruudk), [@&#8203;stephenwade](https://github.com/stephenwade), [@&#8203;towry](https://github.com/towry), [@&#8203;tranhl](https://github.com/tranhl), [@&#8203;yaadata](https://github.com/yaadata), [@&#8203;zodman](https://github.com/zodman) for contributing code, ideas, and feedback to 122 shipped pull requests and 5 resolved issues!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi40IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments