Sunday, September 16, 2012

How to Use Git with Visual Studio 2010 ?

What is GIT ?
  • In software development, Git is a distributed revision control and source code management (SCM) system with an emphasis on speed
  • Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.
  • Git is free software


GIT


For work with Git and VS 2010 You have to Down load and Install below mentioned Software.
(just click below mentioned hyper links)

1. Git Extensions

2.  Git Source Control Provider
   
    Note: for install Git Source Control Provider use below mentioned Steps :
              * Run Visual Studio.
              * Go to Tools | Extension Manager, Search Online Gallery for Git Source Control
                 Provider and  Install. (If you do above stepsthen you don't need to do any extra
                 configurations for this tool)

How to use GIT with VS 2010 ?

Step 1 :  Create a GIT Repository
   
              Select your Project by right click and then click "Create GIT Repository"

Create a GIT Repository

           

   

 













Then You can see Yellow Plus Symbols to denote that there are New Files.

Yellow Plus Symbols


Step 2 : Since I’m working on a New Project, I’ll Commit the New Files by using the 
             "Git Pending Changes" option as below. (right click your project)

Git Pending Changes

Step 3 : Then you can select files which you want to Commit and give a meaningful Comment and 
             Press  Commit Button as below.

 Press  Commit Button

After that it Shows Added State as below.

Added State

Step 4 : When you set below mentioned Setup (TorticeGit Style) then generated Markers are very 
             easy to understand the status of files. 

Using VS 2010 : Tools --> Options --> Git Source Control Provider Options 

Git Source Control Provider Options
Colors Indicators :

Green   - Up to date
Yellow  - New File
Red      - Modified (not commit) 
Colors Indicators


Step 5 :  How to Modify a file and then Commit to Local Master ?

              Do modification to your file and then right click your project and click
              'Git Pending Changes'. It will show below screen.
              Right side of the below screen shows the changes done for the file.Its very useful 
              for double check the changes before Commit. 

Commit to Local Master

Step 6 :  After Defining a Main Repository here  then Push your work for that Remote Repository 
              by clicking "Git Bash" short cut as below. 

Git Bash

Then you need to Type $ git push Your projects Remote Repository URL like below.
Then Username and Password for Remote Git Repository.

Remote Git Repository

That is it.Now your codes are in Remote Git Repository.How easy it is. 

Other Important Git Functionalities

You can do all other Version Control related tasks such as pull,push,revert,commit,merge,stash etc. by using either Git Extensions or Tortoise Tool as below.

Select your project and then right click will popup below screen.

Important Git Functionalities
Important Note:

With Git Extention's  'Push' option is Not Working so far.So if you need to Push your code then You have to use either Git Bash (Command line utility which I showed early) or Tortoise Utilities.


Conclusion
  • By using above steps you can easily use Git with VS 2010
  • My Next Post about Git will explain how to Resolve Conflicts with Remote Repository by using inbuilt Tools in Git.


Happy Coding.

May Be Use Full To You :

3 comments:

  1. I don't know .net. But it seems, this is very descriptive.

    ReplyDelete
    Replies
    1. Hi Semika,

      Thanks for your feedback.
      Do Keep in Touch.

      Delete
  2. have vs.net, I have done same as above explained find path but not able to connect with github , don't have git.exe in installed location. any suggestion ?

    ReplyDelete

Thanks for your Feedback.