octokit / rest.js

GitHub REST API client for JavaScript
https://octokit.github.io/rest.js
MIT License
525 stars 62 forks source link

How to create an empty commit? #427

Closed jisaacks closed 2 months ago

jisaacks commented 2 months ago

I just want to create a commit using Octokit, add a commit message, and put this commit on a remote branch.

Basically I want to simulate this:

git checkout -b myBranch origin/myBranch
git commit --allow-empty -m "my commit message"
git push origin myBranch:myBranch

But obviously I want to keep my local working tree intact and not have to check out a branch locally.

Can this be done?

github-actions[bot] commented 2 months ago

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

wolfy1339 commented 2 months ago

This post on Stackoverflow: https://stackoverflow.com/questions/11801983/how-to-create-a-commit-and-push-into-repo-with-github-api-v3 will guide you.

These are the relevant Octokit docs: https://octokit.github.io/rest.js/v20#git