Why is checking in files called a 'commit'?
Asked Answered
S

5

14

The act of checking in files in a source control repository like git, mercurial or svn, is called a commit. Does anyone know the reason behind calling it a commit instead of just check in?

English is not my mother tongue, so it might be some linguistic I don't quite get her, but what I'm I actually commiting to? (Hopefully I'm not commiting a crime, but you'll never know.)

Is it in the meaning of "to consign for preservation"? Is it related to transactions (commit at the end of a transaction)?

Sidekick answered 20/9, 2012 at 10:18 Comment(0)
H
16

The word "commit" can also mean to secure something for future use or for preservation. For example, "He committed the password to memory." When you "commit" your changes, you are locking them in as they are now for future preservation.

Horodko answered 20/9, 2012 at 10:22 Comment(0)
S
5

Consider also a version-control repository is a referential like databases are referentials.
And the term commit comes from data management, making a set of tentative changes permanent.
(Note that is makes a lot of sense for git, where you add tentative changes to the index with git add, before recording them in the repo with git commit)

A commit in the context of these version control systems refers to submitting the latest changes of the source code to the repository, and making these changes part of the head revision of the repository.
Thus, when other users do an UPDATE or a checkout from the repository, they will receive the latest committed version, unless they specify they wish to retrieve a previous version of the source code in the repository.

Scientism answered 20/9, 2012 at 10:36 Comment(0)
N
2

Blindly copied from my macs lex, doesn't 3 explain it sufficiently?

commit |kəˈmɪt|
verb ( commits, committing, committed ) [ with obj. ]
1 ...
3 (commit something to) transfer something to (a state or place where it can be kept or preserved): he composed a letter but didn't commit it to paper | she committed each tiny feature to memory.
• consign (someone) officially to prison, especially on remand: he was committed to prison for contempt of court.
• send (a person or case) for trial in a higher court: the magistrate decided to commit him for trial .
• send (someone) to be confined in a psychiatric hospital.
• refer (a parliamentary or legislative bill) to a committee.
Neuropsychiatry answered 20/9, 2012 at 12:21 Comment(0)
G
2

The "Check In", "Check Out" terminology dates back at least to the UNIX RCS (Revision Control System) of the early 1980's, whose commands were literally ci and co. In this and other older systems, a file could only be edited by one user at a time, so "Check Out" was analogous to checking a book out from a library. You had exclusive rights to edit the file until it was checked back in.

When CVS (Concurrent Versioning System) came along, it retained this terminology even though the system was designed for concurrent editing and files rarely needed to be locked.

But with systems like GIT, you work on a whole directory tree as one set, and everyone has their own repository, and there's tremendous flexibility in terms of sending commits (changes) here or there. You can by choice set up one server as a central repository, but you don't have to. So checking a file out or in doesn't have meaning anymore. More to the point, the author(s) of git have chosen to abandon that terminology for their system.

Granese answered 28/4, 2020 at 5:31 Comment(0)
D
-4

It's mainly to distinguish the differences between a Centralised VCS like Subversion versus a Distributed VCS. Centralised systems use "check out" and "check in" terminology. These terms help signify that there is some central hub or broker that controls those operations. It has the connotation of a "safe deposit box" that can be opened and then closed. This is especially true when a lock is involved on the file, as is possible on Subversion / TFS etc.

DVCS prefer more agnostic terminology like "commit" and "update" because it exemplifies that there is no central broker involved in those operations.

It would also be confusing to "check in" something, but then still have to "push" it to the remote server. "Check in" has, especially in VCS, connotations that it is an end-to-end process. Which of course would not be true in a DVCS.

You could arguably create a command alias in your DVCS called "check in" which performs both a commit followed by a push. For example.

Divulgate answered 20/9, 2012 at 15:36 Comment(8)
This is completely false. Both CVS and Subversion, the two most popular centralized systems, almost exclusively use the term "commit".Monotonous
Subversion only retained commit because it was a direct CVS replacement. TFS calls it check in and check out. I don't see how this is "completely false". The question needed an answer explaining the subtle differences (in terms of English language) between the various terms and this answer provides that.Divulgate
Subversion only retained commit — that is exactly my point, the term "commit" was in fact used by centralized VCS's for decades. Your answer claims that the term "commit" was introduced by DVCS to distinguish over the older term "check in", which is not the case.Monotonous
Where did I claim that DVCS "introduced" the term commit?!Divulgate
Your first two sentences imply that claim pretty strongly. You say that the term commit is "[used] mainly to distinguish the differences between a Centralised VCS like Subversion versus a Distributed VCS". This is not true, as the term commit was in established use before decentralized systems even existed, and is still used in centralized systems with the same meaning it always had.Monotonous
You're focusing on commit only. This is more a discussion about the duality and meaning of the two operations (checkin|commit & checkout vs commit & update). I don't need some 38 day old StackOverflow user to inform me that the word commit has been used for decades in the world of computing including VCS systems.Divulgate
BTW since you don't seem to know, the ci command line arg for the Subversion client stands for "check in".Divulgate
Of course—in the context of VCS, "checkin" and "commit" have been used interchangably since at least the 80s, and that is the whole point. The OP asked about the linguistic aspect of the word "commit", a word he finds strange as a foreign speaker, as opposed to "check in", which he finds natural. In that sense, other answers provide relevant responses to the question.Monotonous

© 2022 - 2024 — McMap. All rights reserved.