Version Control with Git

Version control is very important aspect of any software project development. Many version control platforms are available such as Git (distributed), Monotone, Apache Subversion (centralized), Mercurial. Version control is ideal for large project teams. It allows us to make changes to files to access them later by using its version. Version Control with Git is preferred by many software developers and managers due to its ease of ease and availability.
GitHub is a platform used to host the Git repositories. It can be accessed using Github is responsible for code management, sharing and continuous integration.

Benefits of Version Control

  • Easy code sharing
  • Easy code change communication among developers.
  • Tracking of changes are very easy
  • Code maintenance is easy

A central server repository is available which contains the official copy of the codebase. This server maintains the history of the repository. A check-in and check-out can be done to access files inside the repository.

Version Control with Git is an example of distributed version control system. In Git, you can pull and clone the changes made inside the repository files. Local repository contains copy of the files in the server. Local repository also contains the version history.

Some important operations of Git are local such as:

  • Check in / check out
  • Commit changes
  • Push changes

Benefits of Version Control with Git

  • Repository files are highly secure
  • Flexibility
  • Wide usage in development community
  • Widely accepted
  • Easy branching capabilities
  • Speed
  • Fully distributed system

The working of a Git model is shown below:

steps- Version control with Git

Basic Steps to follow in Github for development

  1. Create repositories on local computer
  2. Add new files in repository and add file to staging environment
  3. Make a commit
  4. Connect to repo in local

Basic workflow in GitHub

  1. Make commits on computer A
  2. Push commits from computer A
  3. Pull commits to computer B
  4. Add another commit on computer B
  5. Push new Commit

First Time Git setup

The commands for Git setup can be run on Command prompt (windows) or bash.

For initial Git configuration for Git repository, set the name and email config.

The following steps are be used for initial config

$ git config --global "github user name"
$ git config --global user_email

To verify enter:

$ git config -list 

To set editor use:

$ git config –global core.editor 

To create a new Git repository enter( this creates a ‘git’ directory ):

git init 

To add a file in new repository use:

git add file_name

To commit a new file use:

git add  
git commit -m “message”

To push the new file use:

git push -u origin master

Be First to Comment

Leave a Reply

Your email address will not be published.