Git Basic Terms
Git is a distributed version control system, which is freely made available as open source. Several well-known names, like the Linux kernel, Eclipse and Android use Git for managing their projects. Like Subversion (SVN), Git is used for controlling the version (continuous logging of changes) of files. In contrast to SVN however, there are several basic differences. Other terms and schemes, however, can be applied directly. This article will explain the basic terms that regularly appear in connection with Git. In addition, the principles of distributed version control system will be explained.
What is Git?
Git is used to control the versions of files. Predominantly in the programming sector, it serves to monitor changes, undo them, make them available to other so-called "repositories" (repos) or get updates from other repos. In contrast to SVN, Git does not have central repository, but is a distributed system. From the view of the programmer making modifications, their own working copy is a repository in itself. As needed, changes from publicly accessible repos can be incorporated into this working copy, or changes to the working copy can be made accessible to others, as a patch for example.
Thereby, people working with the repo have the following capabilities.
- Their own work can be easily re-integrated into the central database.
- At the same time, development can continue, such as each person working various features.
- Version control prevents existing work from being lost or overwritten.
- Prior versions can be put back in place, as needed, or development can work with different versions simultaneously (also called "Branches").
Moreover, Git also offers more, whose properties other system should consider, as can be read at Why Git is better than X.
- Repository and Working Copy: All of the files, including their previous versions, are located in a repository, or repo. Thereby, all of the changes that have been transferred into the repo are always available, and the question of: "Who made which changes when?" can be asked. What makes Git special is that each user's local working copy (a "clone" from the "git clone" command) represents a complete, localized repo. Thus, there are several copies of the repo and anyone with a clone can work on it, including its entire history, even offline and independent of a central server. Changes from the local repo, or working copy, can all be returned or "pushed" step-by-step back into the remote repository (git push), when they should be visible publicly.
- Branches: When using Git, branches are used to create separate working trees. They can also be viewed as a new context for development. Thus, a security patch may be developed in its own branch (in the context of the patch), which will then be transferred to the master branch upon completion and after testing.
- Version Control: As soon as one starts working with a working copy, Git logs all of the changes made. Using the commit command, the changes can be added to the repository, and a new version of the file(s) will be located in the repo. Subsequently, various versions can be compared with each other and changes can be reverted or returned to a prior version. The log information that Git has recorded can be output using the "git log" command. The "git status" command will list the changes that have not yet been transferred from the working copy to the repo.