-
Hello, I really love this project - after moving on from [big tech company], I really missed the version control tooling there and this does a great job of bringing a lot of those features to git. I'm wondering what other people are doing to integrate with github for code reviews in this tool? My workflow is currently:
The main things I miss from [big tech company] is the automatic syncing between my stack and the review tool (e.g. automatically have a stack of PRs, one per commit, with forward/backlinks), as well as having all the PR-related information on the commit, so when you are moving commits around, they keep all the metadata. A simple solution here might be just having ephemeral branches per commit, and then have the ability to generate a stack of PRs from a stack? This way you can keep all the relevant information (the PR comments, etc) on the branch, but the branch is really 1:1 with a commit on the stack. Has anyone implemented any scripting to do anything like this? It would have to integrate with some of the auto-rebase tools in here e.g. restack/sync - when you restack and create new commits, you have the move the branches as well. Interested to see what other people's github workflows are. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There's some discussion in these threads: #45, #47
You're probably already aware, but for the case of updating existing commits, git-branchless will automatically move branches to point to the newest versions of the commits (or, if it can't, it will prompt you to run
If you have push access and are pushing branches directly to that repository and opening PRs using those, you can set the "base" branch in GitHub to the previous branch, and it will let you merge 0 first and it will automatically update descendant branches. You can also try a tool like https://graphite.dev/ as a web interface to review and merge stacked PRs. I think it has a merge-all action somewhere, and it should also be better at tracking comments for previous versions of the PR. Another alternative is to just do multiple commits per PR and use GitHub's tooling to review and merge them. It's not great, but it has gotten better over the last few years.
git-branchless's There's a lot of existing GitHub PR management tools. You might also want to consider one of these: https://github.com/gitext-rs/git-stack/blob/main/docs/comparison.md GitLab lets you create PRs on push: #45 (comment), so it's unfortunate that GitHub doesn't. Here's an example script to run a command on each branch with the context of its previous branch, from @mlcui-google in #624 (reply in thread). Primarily I'm showing it because it has an example of a complicated revset in case you need to do something special: for branch in $(git query --branches 'draft () & branches()'); do
previous_branch=$(git query --branches "only(branches() & ancestors($branch^), (branches() & ancestors($branch^))^)")
git branch --set-upstream-to="$previous_branch" "$branch"
done Other ideas are @allen-munsch's scripts here: #45 (comment) or @pokey's scripts here: #45 (comment). You could do something pretty similar to iterate over commits and 1) create a new branch with some arbitrary name, and 2) run e.g.
Jujutsu can create ephemeral branches for |
Beta Was this translation helpful? Give feedback.
There's some discussion in these threads: #45, #47
You're probably already aware, but for the case of updating existing commits, git-branchless will automatically move branches to point to the newest versions of the commits (or, if it can't, it will prompt you to run
git restack
).If you have push access and are pushing branches directly to that repository and opening PRs using those, you can set the "base" branch in GitHub to the previous branch, and it will let you merge 0 first and it will automatically update desc…