In order to trigger some automation, I need to push to a gitlab repo as a specific user with a branch name following some specific formatting. For the sake of reference, let's call that user Joe Programmer <jp@company.com>
and the branch name example-branch
.
There's a pre-existing commit that I want to grab and push to gitlab, so I change my user
git config --local user.name "Joe Programmer"
git config --local user.email "jp@company.com"
delete the branch, if it exists, and push that delete to the repo as well
git push origin --delete refs/heads/example-branch
git branch -D example-branch
checkout from my known-good commit
git checkout good_commit
and branch from it
git checkout -b example-branch good_commit
then I commit with an empty change set and push to origin.
git commit -m "triggering automation" --allow-empty
git push origin example-branch
However when I look on Gitlab, I see that it's picked up not only my empty commit (as Joe Programmer) but also the previous commit I've called good_commit
above, attributed to the actual person whose made that commit.
How do I most-easily omit good_commit
, so the only thing that pushes to remote is my commit as Joe Programmer?