From what I understand, git checkout
changes the state of files in the current directory to what it was at a specific point in the tree. Hence it can be used to switch branches or to visit a previous commit.
Why was the name checkout
chosen for this operation?
Is the analogy to "I'm going to go check this out"?
Is it to checking out books from the library?
I'm not asking whether the name is a good idea or not, or trying to offer judgement on that myself -- I'm just wondering what the historical origin of the name is.
DESCRIPTION Updates files in the working tree to match the version in the index or the specified tree. If no paths are given, git checkout will also update HEAD to set the specified branch as the current branch. checkout (co): Check out a working copy from a repository.
In Git terms, a "checkout" is the act of switching between different versions of a target entity. The git checkout command operates upon three distinct entities: files, commits, and branches.
1) Undo uncommitted changes using git checkout --<filename> It rollbacks any content changes to those of the specific commit. This will not make changes to the commit history. Use this to move the HEAD pointer to a specific commit or switch between branches.
git checkout -b BRANCH_NAME creates a new branch and checks out the new branch while git branch BRANCH_NAME creates a new branch but leaves you on the same branch. In other words git checkout -b BRANCH_NAME does the following for you.
Much of this is historical. Pre-git version control systems (VCSes) used the verbs check in and check out as well.
An excerpt from a book I'm working on:
Used as a verb, to version means to put under control of the VCS. Used as a noun, version means a specific version taken from the VCS (of one file, or of a group of files). Usually the noun form appears with additional modifiers, as in the phrase the old version of
kanga.c
or version 2.1 ofroo.c
. If no specific files are listed, we typically mean everything, or at least everything recently under discussion: version 2.1 (of everything in the repository, or of the specific files and/or directories we were talking about). The word revision is always a noun, but otherwise means the same thing as version.Another verb, to check in, means to store into the VCS. As you might expect, if we can check in, we can also check out, meaning extract from the VCS. Some VCSes add the verb to update, which they may use to distinguish between extracting an older version (which you check out) and moving up to the latest and (we hope) greatest (to which you update). Mercurial uses update as a pure synonym for checkout.
I assume the one who can tell you where the name came from Is Linus Torvalds
who developed git.
Based up on the action which checkout does - switching the content of the working directory i can only assume that the origin of this word is like what you have described
Checking out book from the library
From the documentation:
https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html
git-checkout
- Checkout a branch or paths to the working tree
Links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With