Tag Archives: visual studio

Getting started with Git and Visual Studio

GitVs_01 (1)

I use Git with Visual Studio. But I don’t use the GUI,I just keep a command line open as well as Visual Studio. (We are developers and we love typing code )

But here a nice GUI tool that integrates git with Visual Studio

Introduction

This post talk about how to make a simple environment to personal source control with Git Bash, Git GUI and Visual Studio 2010

Some Basic Git Concepts

What is Git:

Git is a distributed version control system that records changes of you software projects.

Repositories

A Git repository is simply a database containing all the information needed to retain and manage the revisions and history of a project. **

Commits

In Git, a commit is used to record changes to a repository. **

Branches

The best way to understand what is a branch is doing commits, when you commit in Git, Git stores its data as a series of snapshots. “Every time you commit, in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.” ** If you make some changes and commit again, the next commit stores a pointer to the commit that came immediately before it. A branch in Git is simply a lightweight movable pointer to one of these commits. A branch often represents an individual customer release. The default branch in a repository is named master

Installing Git (msysGit)

First, download the latest version from: http://code.google.com/p/msysgit/downloads/list After the download completes, run the installer

GitVs_01 (2)

For easier msysGit run, check the two pertinent boxes, to add in the Windows Explorer, as shown

Let’s get started

Git is simple to use. Go to All Programs and open Git Bash

GitVs_01 (3)

Or just open a Command Prompt and type Git.

Configuring the Commit Author

Before making many commits to a repository, you should establish some basic configuration options.

  1. Start Git Bash
  2. git config –global user.name “Your Name”
  3. git config –global user.email “your@mail.com

Create a new Visual Studio Solution with a project (for this example a Silverlight application)

GitVs_01 (4)

Write Code and Save Changes or run the application (F5)

< Rectangle Width="300" Height="100" Fill="Red" />

GitVs_01 (5)

Creating an Initial Repository

Go to solution folder and select “Git Bash here” or at the Command Prompt type “cd path\to\your\solution\folder “

GitVs_01 (6)

To initialized empty Git Repository in your path

GitVs_01 (7)

At Command Prompt Type:

  • git init
  • git add .
  • git commit –m “first commit ( with a rectangle )

Now to get a UI tool Type: gitk We have a first version of our application

GitVs_01 (8)

Now let’s make some modifications

We can add more files (class, service etc.) and commit this changes

< Ellipse Width="300" Height="200" Fill="Purple" />

GitVs_01 (9)

Save changes in Visual Studio and add the change to Git

Making another Commit

At Command Prompt Type:

  • Git add .
  • Git commit –m “Change to Ellipse And so on for other changes in your solution

Viewing the Commit History

Once you have one or more commits in the repository, you can inspect it

At Command Prompt Type:

• Gitk

Our History of changes:

GitVs_01 (10)

What happen if we want back to first commit?

Simple in gitk select “Reset master branch to here”

GitVs_01 (11)

GitVs_01 (12)

Next Visual Studio will detect the changes and reload the solution

GitVs_01 (13)

GitVs_01 (14)

We Back to First Version

GitVs_01 (15)

We can back to other version commit

GitVs_01 (16)

GitVs_01 (17)

GitVs_01 (18)

GitVs_01 (19)

The .gitignore File

You can skip any file by adding its name to .gitignore in the same directory.

For this example in visuals studio , Those are irrelevant files:

bin/ |obj/ |_ReSharper.* |*.csproj.user |*.resharper.user |*.resharper |*.suo |*.cache | *.user |~$*

As you have seen, git is awesome, faster, has ability to handle large projects, distributed, no heavy services or relational database to stored data.

There are lots to learn, but at the moment that’s all folks.

References:

** Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

Leave a comment

Filed under Develop

Let’s start setting our development environment

VS2010SP

Integrate Visual Studio 2010 with Service Pack ?

Slipstreaming Visual Studio 2010 ServicePack?

Is possible?… The answer is NOT (for VS2010) see more info here
Is there any alternative? I got this idea from here

How to prepare an installation of Visual Studio 2010 and Service pack 1 automatically

Make a directory for VS2010 and a subdirectory for Service Pack

For example, <Your drive>:\VS2010\ And <Your drive>:\VS2010\SP1
Copy the contents of Visual Studio DVD and SP to the respective folders
VS2010 and SP1 (1) If you want to install all features, jump to the next step

Making unattended File

To deploy a custom installation you need tell what feature you want to implement, for it is necessary create unattended file ( a |*.ini | file )

  • Second click on the Visual Studio DVD and Press the “shift” key at same time , select “Open command window here”
    VS2010 and SP1 (3)
  • Type “cd setup”
  • Type “setup.exe/createunattend c:\VS2010_deployment.ini”
    VS2010 and SP1 (4)_thumb[1]
  • Follow the directions
  • Select the features that you want and then click Save Settings. VS2010 and SP1 (1)

Create a batch file and Put “VS2010_deployment.ini” in the VS2010 folder

Now to install Visual Studio 2010 RTM and Service Pack 1 together, we need a create a batch to run all automatic

VS2010 and SP1 (2)_thumb[2]

Now all ready, just run this batch file and it will install all automatically. Go for coffee and wait

1 Comment

Filed under Develop