4

I am learning git, and I have difficulty understanding how some commands relate to english, particularly git checkout --file.

From context (https://try.github.io/levels/1/challenges/17 : Files can be changed back to how they were at the last commit by using the command: git checkout -- . Go ahead and get rid of all the changes since the last commit for octocat.txt), I understand it means something like return your code to the state it used to be in when you committed changes for octocat.txt last time.

And this is meant by checkout? Could you please point me to the closest meaning (from here maybe http://www.merriam-webster.com/dictionary/checkout) that they were trying to pass? (otherwise, it makes it very difficult to learn since it becomes meaningless)

1
  • Also, don't miss on the book for more context.
    – user98955
    Dec 3, 2014 at 5:14

3 Answers 3

3

To add more to @dnagirl's answer, I think the underlying metaphor used here is a lending library. (Checkout isn't specific to git; it's also used in RCS, which is much older—the oldest source control system, I believe.) One checks out a book at the library, reads it, and then checks it back in. Before computers, I only saw checkout as one word as a noun: the checkout desk. However, it's much easier to render computer commands as single words. Git uses a hyphen in cherry-pick, so I assume they avoided check-out to retain familiarity with RCS and other older systems.

Obviously git differs from the lending library inasmuch as you aren't supposed to change the book you borrowed…

5
  • 1
    Note that the choice of terminology is historical. In older version control systems, checking out a file would prevent other users from writing to it until is is checked in again. Git has no such limitation. Dec 3, 2014 at 8:34
  • 1
    @200_success, your comment is illuminating. Dec 3, 2014 at 10:52
  • @Andrew You are correct that checkout derives from RCS, but in RCS the term is check out. Also RCS is not the oldest source control system. Other systems such as SCCS and IEBUPDTE precede it.
    – user63230
    Dec 3, 2014 at 13:02
  • @andy256 Thanks for the reminder. I had forgotten SCCS. And in RCS, the term is co. I should remove it, because I am always typing ci (check in) for vi (an editor). Dec 3, 2014 at 16:59
  • @Andrew co and ci are the abbreviated command names. Just er check out those references and edit as you see fit, without changing what is after all the OP's accepted answer too much.
    – user63230
    Dec 3, 2014 at 20:21
1

When you checkout files from a versioning software, you take a copy of those files for yourself. If you make changes to your local copy and you don't like them, you can checkout the files again which will copy the repository version over your local version.

2
  • does it come from 'To withdraw (an item) after recording the withdrawal: check out books.' then? or it doesn't really originate from normal check out verb meaning? Dec 3, 2014 at 5:27
  • @lakesare: programmers usually try to choose command names that help people remember what the command does. Though I have no idea if the git programmers were thinking about libraries when they named their checkout command, it is a reasonable supposition.
    – dnagirl
    Dec 3, 2014 at 5:41
0

Git checkout version control system means take all files from the repository. So, you can work on it and make modification where you want. You can also commit your changes back to your git server so, other can take your update and look at your kind changes from file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.