Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git town ship does not work when merge queues are enabled on Github #3294

Open
breml opened this issue Apr 3, 2024 · 6 comments
Open

git town ship does not work when merge queues are enabled on Github #3294

breml opened this issue Apr 3, 2024 · 6 comments
Labels

Comments

@breml
Copy link

breml commented Apr 3, 2024

Steps to reproduce

  1. Have a repository, where merge queues are required (repository needs to be owned by an organization, details in the previous link).
  2. Have a PR ready to be shipped.
  3. Execute git town ship

Command output

$ git town ship

[branch] git fetch --prune --tags
Enter passphrase for key '.../id_ed25519_sk': 

[branch] git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

[master] git merge --squash branch
Updating b0fce7528..980483e8a
Fast-forward
Squash commit -- not updating HEAD
<redacted>
 4 files changed, 4 insertions(+), 4 deletions(-)

[master] git commit
[master be9366e8b] commit message
 4 files changed, 4 insertions(+), 4 deletions(-)

[master] git reset --hard HEAD~1
HEAD is now at b0fce7528 some other commit message

GitHub API: merging PR #5216 ... ok

Error: PUT https://api.github.com/repos/org/repo/pulls/5216/merge: 405 Changes must be made through the merge queue []
Auto-undo... 


[master] git checkout branch
Switched to branch 'branch'
Your branch is up to date with 'origin/branch'.

Error: PUT https://api.github.com/repos/org/repo/pulls/5216/merge: 405 Changes must be made through the merge queue []


### Additional information

_No response_
@breml breml added the bug label Apr 3, 2024
@kevgo
Copy link
Contributor

kevgo commented Apr 3, 2024

Some things that Git Town could do here:

  • display a proper error message
  • provide a config setting for .git-branches.toml to disable ship for this repo since it uses a merge queue and ship doesn't work

@breml
Copy link
Author

breml commented Apr 3, 2024

Aren't merge queues available through the github api as well? I would have hoped, that Git Town could have a config setting that does trigger merge queue instead of a regular merge/squash of a PR.

@kevgo
Copy link
Contributor

kevgo commented Apr 4, 2024

Good point. I forgot that GitHub's merge queue really only replaces the "merge" button and doesn't do the testing. git ship should detect the merge queue and merge the PR through it instead of merging directly.

Having said this, most people probably don't need to use git ship at all. This command was invented before GitHub was in widespread use. Nowadays, it's often easier to use Git Town to create and sync branches, and then review and merge them (with or without the merge queue) using the GitHub UI.

@breml
Copy link
Author

breml commented Apr 5, 2024

Thanks for your explanation about the use of git town ship. For me, the complete workflow with Git Town in combination with Github is not yet full clear, especially when a PR is ready to be merged and then the cleanup should happen. What do you advise in this case?

For me, the workflow should look something like this:

  1. git town hack feature-1
  2. work on feature-1 as normal (git add, git commit, git push)
  3. create PR on GH, wait for approval (should I use git town propose for this?)
  4. start work on dependent feature 2: git town append feature-2
  5. work on feature-2 as normal (git add, git commit, git push)
  6. Received some feedback for feature-1, git town switch, git town sync, git add, git commit, git push
  7. Continue on feature-2: git town switch, git town sync (add, commit, push)
  8. create PR on GH, wait for approval (should I use git town propose for this?)
  9. feature-1 is approved, now what? merge on GH or use git town ship?
    after the merge, how do I properly cleanup feature-1 and make sure that feature-2 now has master as parent and is sync properly?

Thanks for your explanation.

@breml
Copy link
Author

breml commented Apr 5, 2024

If I get your answer in #3298 (comment) correctly, I just run git town sync in step 10 of the above message and everything should be cleaned up "automagically", correct?

@kevgo
Copy link
Contributor

kevgo commented Apr 5, 2024

Your questions are legit. I'm planning a series of screencasts that explain this better in the coming weeks.

create PR on GH, wait for approval (should I use git town propose for this?)

You can use git town propose for this but don't have to. All it does is open the web page to create the PR for you.

  1. feature-1 is approved, now what? merge on GH or use git town ship?

You can do either. If you use git town ship, it also updates the PRs of all child branches. That requires support for the merge queue though.

Most people merge through the GitHub UI these days. I think GitHub is now smart enough to update PRs of child branches, but I need to verify that (am traveling right now). Then run git sync to get your local workspace up to date.

@kevgo kevgo added feature and removed bug labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants