git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Squash & Merge Implementation

From
VBVadim Belov <vadim.belov@gmail.com>
Date
Aug 3, 2018, 12:01 UTC
Message-ID
<CALr1GiFBm9zJ1v-UWuVLWJJ+zFh-iTKOv=T4KETLN8qkW_0pAg@mail.gmail.com>

Hello, I'm trying to manually implement Github's *Squash&Merge *functionality. After looking many forums like stackoverflow.com I'm still struggling with the issue.

*The scenario is as follows*:
- master is a protected branch (configured on github)
- a service user *svc *is permitted to push to master (configured on github)
- other users don't have such permissions
- github PR status check is set to SUCCESS before execution of any set of
git commands below
1. This merges successfully without squash:
git checkout origin/master
git merge ${PR-Branch}
git push origin HEAD:master
git push origin --delete ${PR-Branch}
2. This closes the PR, but there is no update seen on master:
git checkout origin/master
git merge --squash --commit ${PR-Branch}
git push origin HEAD:master
git push origin --delete ${PR-Branch}
3. This fails to push to master with the error "GH006: Protected branch
update failed"  (despite that the PR is set to SUCCESS):
git checkout origin/master
git merge --squash ${PR-Branch}
git commit -am"comment"
git push origin HEAD:${m_mainBranch}
git push origin --delete ${m_prBranch}
Will appreciate your help on this.

Thanks, Vadim

Next: Jeff King
Message 1 of 3 in “Squash & Merge Implementation”
  1. Vadim BelovAug 3, 2018
  2. Jeff KingAug 3, 2018
  3. Vadim BelovAug 3, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.