Closed ghost closed 2 years ago
For example:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/cnmade/bsmi-kb/pulls \
-d '{"head":"for/master","base":"master"}'
When I contributed "proc-receive" and "report-status-v2" to Git, Peff (Jeff King from GitHub) told me github has a tailored version of git-receive-pack, so it's not possible for github to support "proc-receive" quickly.
If you want to create pull request using github API, it's better to use github CLI tool. When creating pull request this way, you have to create a real topic branch, and cannot do like agit-flow or gerrit, which are built-in in this tool.
See what we discussed in git mailing list: https://lore.kernel.org/git/20200507172713.GA3645853@coredump.intra.peff.net/
@jiangxin all works can be implement at client side .no more need to hack into git core.
I made some rush code to implement it.
see: https://github.com/cnmade/git-cpr/blob/for/dev/main.go
It works for me
Ref: https://docs.github.com/en/rest/reference/pulls#create-a-pull-request
after local code change, we type git pr
this action will look for if the origin URL was github
If github ,then make API call to create new pull request
we can using .netrc to let git auto know the token to access the github api
Amazing way.