💾 Archived View for idiomdrottning.org › agit captured on 2024-08-18 at 18:34:52. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-03-21)
-=-=-=-=-=-=-
Update: The upstream documentation was updated shortly after I wrote this, clarifying some of the things I was unsure about:
On Gitea instances and Forgejo instances (like Codeberg) you can create git PRs from the command line without using the web and, unlike GitHub, you don’t have to install any new apps outside of the git you cloned with.
You do need an account on that particular instance that the repo is hosted on. It’s not truly decentralized the way git send-email or git request-pull is. Those two methods are way more awesome and I’m always glad to see more support being built for them instead of for this local-account-only PR workflow. Needing a thousand accounts all over the place is such a pain with the Gitea/Forgejo model.
Clone the repo, make and commit your changes, figure out what branch you want to push it to (this example will use the branch name "main").
Then run
git push origin HEAD:refs/for/main -o topic=main
That prompts you for your username and password on that instance and now the awesome part is that it creates the fork and the PR and everything else for you, you don’t have to fiddle with an annoying web UI. It’s all from the comforts of your own cozily scriptable CLI.
If you wanna use a feature branch, let’s say you’re working on a feature called “hacks” that you wanna push into main, that’d be:
git push origin HEAD:refs/for/main -o topic=hacks
You can also replace the word for (which means a normal PR) with drafts or for-review and change the title or description with -o title="My important PR" -o description="This fixes the dosh-distimmer so we don't have to rely on that darn Gostak" or whatever.
Now, pushing to origin with that weird custom refspec again will open new PRs.
If you instead wanna push more changes to your already-submitted-waiting-for-merge PR, I’m not sure how to do that yet, maybe that’s what the -o topic= is for.
Unlike GitHub where every project you send PRs to will litter your own account page with a useless dangling fork, here the forks seem more ephemeral, they don’t show up on the webpage and you can’t even clone them down again, they only exist for the PR. So when I make drive-by commits on GH, I often just work from /tmp because if I ever need my own version of that repo, I can clone it from the web page, but Forgejo/Gitea works differently in that regard.
I got the impression that this is on by default for repos created within the last few years but older repos need to turn on agit support.