git | what is git | git tutorial

What is git? A version control system.

Git is a distributed version control system (DSVC).  Like any other version control software. Git provides all necessary features to work on a shared source tree with many developers simultaneously. Git is very popular for its features. Was initially developed by Linus Torvalds for Linux kernel development.

For a larger scale of software development, a subversion control system (SVC) is highly effective for parallel development,  Track changes, branching, merge, etc.  A central copy of code is maintained called a repository.

For example, in a company, ten software developers are working on the same project, in parallel, each developer developing a module of a project.  Once a feature completes in software (e.g., developed, git commit and git push )  by one developer. The new feature will be automatically available to other developers.  If version control is not used, other developers have to take/merge the code manually.

In case of conflicts (at the same place in code two developers has written) between two sub development, the version control (VC) shows both the work and developers can manually merge (select correct code). They can update (using git push command) in the central repository. VC maintains a set of files for a commit, any point in time the set of files can be retrieved when any change in SVC is made ( source file is added or modified), the version number changes or advances.

git or what is git
SubVersion Control

Central,   version control (SVC): A central copy called repository is maintained on a machine.  If any user commits the changes, the central copy is updated.

Distributed SVC: Every user has a full copy of the repository (git clone command creates) on a local machine, along with a central or remote repository.  The local copy has a full history of changes.  All operations (branching, merging, etc.) can be done on a local copy, so even there is no internet access, all SVC things can be done.  When a commit (git commit) is done, it changes the local repository copy.  If the changes have to available to other users, the central copy is updated (git push command). Other users can update local copy by git pull.

List of useful Git  commands :

  • git init creates a new repository.
  • Git merge command merges the code from a branch to the current working branch. If the git merge gives conflicts, then conflicts should be resolved manually.
  • Git clone command creates a full copy of the repository on a local machine. The local repository has a full history of all changes.
  • Git push – command if a user makes changes and does commit.  Changes go into the local repository and not available to other users. When code changes need to updated on the central repository, git push is used. After a successful git push, other developers can update the local copy.
  • Git checkout command enables the user to switch from one branch to another or to create a new branch and switch to the new branch. The git branch can list all branches, and git checkout use can switch to a branch.
  • Git pull – command updates the local copy from the central repository. It does code download and does git merge.
  • Git branch command displays all branches in the current local repository.
  • Git revert command undoes changes.
  • git add command prepare the staging area for next commit

Git Advantages:

  • A full git repository can be recovered from any local repository in case of central repository failure.
  • Branches are lightweight in git, as they have only reference for change codes, not the full copy.
  • There is a staging area in git. This area can be prepared for the next commit. Can add files or directories for the next commit.
  • It is distributed in nature, highly effective for parallel development. Offline users can also take full advantage of a source control system.
  • Accountability, git does details logging for every commit. A user who commits can be traced easily.

Leave a Comment