If I understand you correctly, you are aiming at copying (cherry-picking) every commit from send-to-github
to receive-from-gitea
branches.
I would assume there are more elegant ways to achieve this, but here is a quick and dirty way to get (I assume) what you want.
There are some prerequisites to cover, such as - have 2 already defined remote URLs (origin
and github
as an example).
Create yourself a script like so:
#!/bin/bash
# First push to gitea
git push origin send-to-github
# Get the currently pushed commit that you just created and pushed
CURR_COMMIT_SHA=$(git rev-parse HEAD)
# Go to your other branch that must go to github
git checkout receive-from-gitea
# Apply the commit so that it is "copied" onto the github branch
git cherry-pick $CURR_COMMIT_SHA
# Push to your github remote repository
git push gitub receive-from-gitea
Make it executable and add it as an alias to your git configuration:
[alias]
double-push = "!c() { bash /path/to/script.sh ; }; c"
Then once you are ready to commit and push to your Gitea repo, instead of pushing with git push
use your newly created alias git double-push
and it should work as intended.