github-apisquashgit-squashgithub-graphql

is it possible to squash commits via Github API?


I've successfully implemented automatic file creation/update via Github V3 Rest API, however the only downside is that for each file I have a commit.

There is a possibility to do the same for multiple files, but unfortunately it involves some concepts I still haven't mastered and it will take me some time until I get there since I have more urgents stuff on my TODO list.

In the meanwhile, I can totally live with that or simply squash the last N commits, which I imagined should be relatively easy, since locally it's just a matter of

git reset --soft HEAD~N
git commit -m ".."

but I couldn't find anything on the docs or online

So my question is: how can I squash the last N commits, non interactively, using Github API?

Ps: I don't care if it's v3 or v4 as long as I get it done


Solution

  • I did not see a squash feature directly through API.

    You would need to:

    Pretty convoluted, but it should work (entirely through script, without having to clone the repository).