Git: how to handle commit so that file versions exist fully (not just as differences)

Is there a way to force Git to store versions of a file as complete, and separate entities, unlike a downstream, compile existing ones, how is it different from an upstream commit?

Some will ask why I want to do this. I want to do this because my boss told me this. FWIW, the specific file in question, is the product of a process in which a small change in input can lead to a significant restructuring of the file.

+1
source share
2 answers

Git object storage already does this, and it is not negotiable.

The Git object base is focused on snapshot, individual blob files, and directories - tree .

Confirm this easily by looking under .git/objects or by doing

 git rev-list --objects --all 

Now, after a while, for efficiency, the database of objects will be β€œcompressed” (known as packaging). This leads to storage efficiency, but does not include sotring debate.


Background

Delta storage has been popularized by RCS, CVS, Subversion, and others (SourceSafe?). Mostly because the model has simplified the transfer of sets of changes because they would already be in the form of a delta. Modern VCS-es (mostly distributed) have evolved from this and put emphasis on data integrity .

Data integrity

Due to the design of the object database, git is very reliable and will detect any corrupted data bit anywhere in the snapshot or the entire repo. See this post for more information on the cryptographic properties of git repositories: Linux - git vs. data corruption?

In techno-chatter: capturing stories form cryptographically strong measurement trees. When the sum sha1 of the commit (HEAD) vertex matches, it mathematically follows that

  • tree contents
  • branch history (including all accounts and committer / author credentials)

identical. This is a huge git security feature (and other SCMs that use this design feature)

+7
source

Git objects are stored as complete files. (Except in gc cases of your repo, then they are optimized, but this is implementation detail). If you know the git sha file, you can get it in its entirety:

 git cat-file -p <sha> 

which will output the file by its type.

You can see an article about it on 365git - Git Objects: Blog

+2
source

Source: https://habr.com/ru/post/953034/


All Articles