The last week we travelled through Version Control .You can think of a version control system (VCS) as a kind of "database". It lets you save a snapshot of your complete project at any time you want. Version control gives access to historical versions of your project. This is insurance against computer crashes or data lossage. If you make a mistake, you can roll back to a previous version. You can reproduce and understand a bug report on a past version of your software. You can also undo specific edits without losing all the work that was done in the meanwhile. For any part of a file, you can determine when, why, and by whom it was ever edited.There are many benefits of using a version control system for your projects.

here is a good description about VCS 

working copies:  Your working copy (sometimes called a checkout) is your personal copy of all the files in the project. You make arbitrary edits to this copy, without affecting your teammates. When you are happy with your edits, you commit your changes to a repository.

Repositories: A repository is a database of all the edits to, and/or historical versions (snapshots) of, your project. It is possible for the repository to contain edits that have not yet been applied to your working copy. You can update your working copy to incorporate any new edits or versions that have been added to the repository since the last time you updated. See the diagram at the right.

Distributed V/S Centralised

There are two general varieties of version control: centralized and distributed.The main difference between centralized and distributed version control is the number of repositories. In centralized version control, there is just one repository, and in distributed version control, there are multiple repositories.

Some popular version control systems are Git (distributed), Mercurial (distributed), and Subversion (centralized).

Git  

Here we use git as our version control system.Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. We follow the famous book Pro Git , written by Scott Chacon and Ben Straub.it is designed good  easy to understand and simple language and everything explained well.you can download it free from this link: ( https://git-scm.com/book/en/v2 ).and there is an active community with mailing group ( https://git-scm.com/community ).

first of all we installed git on our system:

$ sudo apt install git-all

to show installed version in our system :

$ git --version

There are many commends in git to access it.Here is a list of some basic Git commands to get you going with Git.

First-Time Git Setup

git config

we can change the name and email that is associated with your Git commits using the git config command

$ git config --global user.name "fairoos"
$ git config --global user.email fairoosnm123@gmail.com

Now, we can configure the default text editor that will be used when Git needs you to type in a message.

$ git config --global core.editor emacs

let's go

here we discuss some popular commends git .first we make some directory that we want to use version control.here a directory called my_project and there are two files in it .shown below

git init

git init creates a new Git repository, can be used to convert an existing, un-versioned project to a Git repo, or initialize a new, empty repo.

git status  

This command lists all the files that have to be committed,here we dose't staged or commited any files

git add

This command adds a file to the staging area.here we add two  files to staging area first.c and new.Then we check the status and find the difference between staged and un-staged

git commit

This command records or snapshots the file permanently in the version history.

git log

This command is used to list the version history for the current branch.

we can use many arguments with log like -p, -<n>, grep,%s,%h,%en...........,by this we can customise log.

git log [<options>] [<revision range>] [[--] <path>…​]

git clone

This command is used to obtain a repository from an existing URL.

$ git clone https://github.com/torvalds/linux.git linuxkernal

it is not a idea to go through every commends,there are lots of commends there.

  • git diff
  • git reset
  • git rm
  • git log
  • git show
  • git tag
  • git branch
  • git checkout
  • git merge
  • git remote
  • git push
  • git pull
  • git stash
  • etc.........

here we stop the discussion about commends and for more info and docs: https://git-scm.com/docs

Then we start an account in git hub and still now working with it .let's discuss about it in next blogs.

thanks........