My whole team seems to be managing its local branches based on the ability to visually see in the commit graph that it has been merged,
This seems to be a real problem right here. If you are already using the GitHub pull-request workflow, the status of the transfer request should be the authoritative answer to this question. Is PR accepted? Good! Branch merged, continue your life.
One option that you might want to consider is to accept (and possibly enforce) a workflow in which you accept only one-time requests. Let people do whatever they want in their local repositories, but by sending a pull request, they distribute the corresponding commits together before sending (and make free use of the redirect workflow locally to update the transfer request if they need to make changes).
This has the advantage that the “visual validation” method will continue to work as you will no longer synthesize commits on GitHub.
Update
I put together a small tool that uses the GitHub API to determine if download requests associated with this commit have been closed. Dip the git-is-merged script in your $PATH somewhere, and then you can do this:
$ git checkout my-feature-branch $ git is-merged All pull requests for 219e0f04a44053633abc947ce2b9d700156de978 are closed.
Or:
$ git is-merged my-feature-branch All pull requests for 219e0f04a44053633abc947ce2b9d700156de978 are closed.
The script returns status text and exit codes for:
- No traction requests
- All download requests are closed.
- Some transfer requests are closed.
- All download requests are open.
For crushed commits, you can use any of the commit commands that were part of the original pull or commit sha request for a compressed commit.
As written, this tool will only work with public repositories, but it uses the PyGithub module, which supports authentication.
source share