My question:
Let's say I have a file that represents an array, where each element of the array is separated by a new line character. How would I append a new line to the end of that file, without actually editing the file directly? Just by creating a new blob, and associating that blob with a tree?
Then, imagine if the file began and ended with square brackets, so now to append to this "array" I need to insert at one line minus the end of the file (you can assume the brackets have a new line after/before, respectively)
The bonus round is taking the same logic from above, but applying it to just arbitrary lines within a file. This isn't so necessary for what I'm working on, but git obviously has a way of doing this, so I'd like to understand the general solution.
For context why I even want to do this:
I'd like to update a file that's in a GH repo, without actually pulling the file to do it. GH has a low level API that's basically an HTTP interface exposing many low-level GitHub operations. So, I'd like to just say "add this line, to this file", without having to clone the repo or do a bunch of back and fourth over the network.
That said, at the end of your question you stop talking about git and start talking about GitHub and APIs offered by them, which is of course entirely unrelated to working with git itself and they could provide absolutely any random complex functionality.