GIT and Perforce: Branching Strategy

I study two source control systems and find that their branching strategies are very different.

This Perforce copies its entire source file to a new branch, although it adapts some tricks (eg, lazy instance, "p4 -v") to prevent space growth, but in the end it will consume more space and leave more metadata. Instead , in GIT, branching basically moves pointers. I am wondering why Perforce cannot adapt the same approach? Is this because it involves the burden of storing snapshots (like in git) instead of the difference in the files (like in Perforce)?

Also, why does GIT store snapshots of files instead of the difference? Is there a need for this? Does this mean that in general the repository of GIT code will be larger than in Perforce? If the same needs to be stored on both systems? Will the commit be longer for GIT?

+4
source share
2 answers

Git really stores the delta as well. These are called package files. If you modify the file several times, it will not contain 100 slightly different objects. (more info here: http://git-scm.com/book/en/Git-Internals-Packfiles )

Snapshots are the absolute truth why git keeps such a story. It takes a simple approach, not suggesting how and why files have changed in a certain way. This vision is for the tool described above to analyze history in order to provide you with information such as "this file was renamed at this moment."

If this was part of the story, you will have to rewrite it all if your threshold changes for what constitutes renaming with a slight change compared to deleting and creating. Just better. The fact that it was designed on linux to track Linux source code follows a similar philosophy to this platform.

+4
source

This is actually a complex topic, but there are trade-offs in how they view branching and file history. Git forking is at the repository level, while Perforce can be very grainy and allows you to split a single file or multiple sets of files that are usually developed independently.

Git branches are very quick and easy, as you mention, while Perforce branching gives you a bit more control over what happens.

+1
source

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


All Articles