How to install and configure Git on windows 7 using Git GUI and perform basic operations

Pranay
Feb 04, 2015  ·  3305 views

This post will explain a naive user on what is Git, how to install Git Gui on a windows 7 machine, how to create a simple repository and perform basic operations

###Git:

As per Wikipedia, Git is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development.

In simple words Git is tool used for Source Control Management built on linux initially and supports almost all operating systems now.

Other famous SCM alternatives for Git are Microsoft TFS, SVN etc. You can find more alternatives here(Wikipedia)

###Installation of Git:

Download Latest GIT from http://git-scm.com/ . This download is a single executable which installs the entire 'Git Gui' in our windows machine. The installation will be simple and straight forward. While going installing, check the options to add Windows Explorer integration “Add Git GUI here”.

###Creation of Repository:

  1. We have installed the Git on our windows machine, next we have to create a repository in Git and then add your code to the repository.

  2. Create the folder you want the project to live under and then right click on the folder and choose Git GUI here. Then popup will appear with option ‘Create New Repository’ and other options.

  3. Select ‘Create New Repository’ to create new repository and then provide the path of the new folder. Click on ‘create’. This will create a repository and display the main window of Git GUI with ‘Unstaged Changes’ window, ‘Staged Changes’ window to the left.

Configuring author name and Email Id: We can add author name and email Id so that wherever a commit is made the commit messages can be sent to the author. For this, choose Edit -> Options and then provide the name and email Id under the created repository to the left and to the Global (for all repositories) to the right.

User Name: RepoAuthor

Email Address: RepoMaster@mywebsite.com

###Committing:

  1. Now go to the repository folder which you have created and add some new files or add your existing code to that folder.

  2. Go to ‘Commit’ menu at top and click on Rescan (or directly click on Rescan button at the bottom) or just use the shortcut ‘F5’.

  3. All the new files you created or the code you have added to the repository folder will be appearing in the left window under ‘Unstaged Changes’.

  4. You can view the changes in each of the file by selecting the file. Once the changes are confirmed and ready for commit, click on the icon beside the filename to move the file from ‘Unstaged changes’ window to ‘Staged Changes’ window. (You can also do this for all the files at a time using the option ‘Commit’->’Stage Changed Files to Commit’).

  5. Provide a commit message in the window below and click on commit to commit the changes.

###Branching:

To create a new development branch in Git GUI, choose ‘Branch’->Create. Give some name for the branch and select the master as the Revision branch. Click on create. This will create and open the new branch as the Current branch.

###Switching branches:

If we need to make some changes to the Master Branch we can check out the branch and do the changes and then commit that.

Go to Branch->Checkout and then select the target branch. It will checkout the target branch and open it as the current branch.

AUTHOR

Pranay

A Software Engineer by profession, a part time blogger and an enthusiast programmer. You can find more about me here.


Post a comment




Thank you! You are now subscribed.

Sign up for our newsletter

Subscribe to receive updates on our latest posts.

Thank you! You are now subscribed.