In this tutorial, we will create a branch with two commits without using git. This exercise aims to provide a better understanding of git’s data structures, particularly the “git objects.” We will use Python to perform all the necessary tasks. It’s important to note that although the steps will produce a valid git commit, it is not advisable to use this method in a production environment. Git commands include safety checks and special handling that we will skip for simplicity. Git objects are immutable storage units in Git, compressed using the DEFLATE algorithm and referenced by the SHA-1 hash of their contents. They store the different versions of project files and other metadata. The tutorial provides examples of the four most important git objects and how they interact. Commits in git are not diffs but rather snapshots of the entire project at a specific time. The diffs are generated on-the-fly when needed. The tutorial covers how to create a blob (binary large object), which stores file contents, and a tree object that describes the directory structure. It also demonstrates how to create a commit and a branch using Python. A branch in git is merely a label, and creating a branch after making commits is important to avoid dangling objects that could be pruned by git’s garbage collector
https://matheustavares.gitlab.io/posts/committing-without-git