Wrong way arrows in GIT documentation

  • Thread starter Thread starter the_emi_guy
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the representation of arrows in GIT workflow documentation, specifically why they are often drawn in a direction that some participants find counterintuitive. The conversation touches on concepts of version control, dependencies, and the nature of snapshots in GIT.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • Some participants question why arrows in GIT documentation are drawn backwards, suggesting that arrows should point from commits C4 and C5 to the resulting commit C6.
  • Others clarify that the arrows indicate dependencies of a version on prior versions rather than the evolution of the software.
  • One participant references the Pro Git book, explaining that GIT stores commit objects that point to their parent commits, which may justify the backward arrows in diagrams.
  • Another participant argues that GIT creates fully standalone snapshots at each version, implying that there are no dependencies on prior versions, unlike other version control systems.
  • Some participants note that while GIT does not create new snapshots of the entire repository, it uses hashes to manage files, which may influence how dependencies are perceived.
  • A participant suggests that the backward arrows may be beneficial for programmers who need to trace the origins of code, as they often look back through history rather than forward.
  • Concerns are raised about the stability of pointer records if arrows pointed forward, suggesting that backward arrows help maintain consistency in version histories.

Areas of Agreement / Disagreement

Participants express differing views on the purpose and implications of the arrow direction in GIT documentation. There is no consensus on whether the current representation is optimal or if it should be changed.

Contextual Notes

Some limitations in the discussion include varying interpretations of what the arrows represent, the complexity of GIT's snapshot mechanism, and the differing experiences of participants with version control systems.

the_emi_guy
Messages
766
Reaction score
79
Anyone have any idea why the arrows in GIT workflow documentation are always drawn backwards?

For example, the logical way to diagram C4 and C5 merging to become C6 would be with arrows from C4 and C5 into C6, not the other way around.
 

Attachments

  • git.jpg
    git.jpg
    4.5 KB · Views: 585
Technology news on Phys.org
The arrows are not showing the direction of evolution of the software. They are showing the dependencies of a version on prior versions.
 
  • Like
Likes   Reactions: the_emi_guy
From chapter 3 of the Pro Git book

When you make a commit, Git stores a commit object that contains a pointer to the snapshot of the content you staged. This object also contains the author’s name and email, the message that you typed, and pointers to the commit or commits that directly came before this commit (its parent or parents): zero parents for the initial commit, one parent for a normal commit, and multiple parents for a commit that results from a merge of two or more branches.

So in the tool you use, I would think the diagram show parent arrows because that is the direct information present for a version. You can of course flip the arrows in your head (or by using another tool perhaps) if you like, as long as you remember that behind the scene children points to parents and not the other way around.
 
  • Like
Likes   Reactions: the_emi_guy and FactChecker
FactChecker said:
The arrows are not showing the direction of evolution of the software. They are showing the dependencies of a version on prior versions.

But in GIT there are no dependencies on prior versions, GIT creates fully standalone snapshots of the code at each version (unlike ClearCase where only differences are recorded, so there are dependencies on prior versions).

In GIT, C4 and C5 are merged to form a standalone snapshot of the merged C6 that no longer depends on C4 or C5 for reconstitution.

In other areas of science and engineering arrows generally denote evolution when things are changed/combined to form new things (CH4 + 2O2 → CO2 + 2H2O).

So as a non-computer scientist who has had a need to learn GIT, I was just wondering if there is a good reason for showing the reverse.
 
the_emi_guy said:
But in GIT there are no dependencies on prior versions, GIT creates fully standalone snapshots of the code at each version (unlike ClearCase where only differences are recorded, so there are dependencies on prior versions).
Sort of, but not really. It doesn't create a new snapshot of the entire repository, only the files that have changed. It works by creating hashes of the files, so if two files are the same between two different branches, they will point to the same file.
 
  • Like
Likes   Reactions: the_emi_guy and FactChecker
the_emi_guy said:
But in GIT there are no dependencies on prior versions,
So as a non-computer scientist who has had a need to learn GIT, I was just wondering if there is a good reason for showing the reverse.
As @Filip Larsen said, you can always flip the arrows in your mind, but there is are a couple of reasons for pointing backward. The first I am sure of and the second I am assuming:
1) As a programmer trying to document, debug, or understand a program, you need to know where the code you are looking at came from and why it is there. So you are tracing backward, all day, every day. As a working programmer, it is not nearly as often that you are looking at code and tracing forward to see what happened in later versions. (There might be hundreds of later versions.)
2) When you make a new version, you also make a new record that points back to the parents. That pointer record doesn't need to change later. So if two people download the same version for development, all the history would remain identical as their two versions diverged. If it pointed forward, the pointer record for a parent version would change every time a new version was derived from it. The data base would be less stable and it would be more difficult to compare and merge GIT depositories.
 
Last edited:
  • Like
Likes   Reactions: the_emi_guy
newjerseyrunner said:
Sort of, but not really. It doesn't create a new snapshot of the entire repository, only the files that have changed. It works by creating hashes of the files, so if two files are the same between two different branches, they will point to the same file.
FactChecker said:
As @Filip Larsen said, you can always flip the arrows in your mind, but there is are a couple of reasons for pointing backward. The first I am sure of and the second I am assuming:
1) As a programmer trying to document, debug, or understand a program, you need to know where the code you are looking at came from and why it is there. So you are tracing backward, all day, every day. As a working programmer, it is not nearly as often that you are looking at code and tracing forward to see what happened in later versions. (There might be hundreds of later versions.)
2) When you make a new version, you also make a new record that points back to the parents. That pointer record doesn't need to change later. So if two people download the same version for development, all the history would remain identical as their two versions diverged. If it pointed forward, the pointer record for a parent version would change every time a new version was derived from it. The data base would be less stable and it would be more difficult to compare and merge GIT depositories.

Very good, thanks, I get it.

Thanks everyone.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
6K
Replies
4
Views
4K
  • · Replies 14 ·
Replies
14
Views
7K
  • · Replies 14 ·
Replies
14
Views
2K