Git for Windows and .NET Developers Part 2 – Advanced Tools and Options

If you followed my last post, you’ve got Git installed. You can initialize and commit to a repository. What now?


You could constantly type git branch to see which one you’re on, and git status to see how many adds / mods / deletes you have, like this:


Alternatively, you could just see those bits of information in your prompt:


This magic comes from posh-git, and here’s the way I got it installed. These are just about the same instructions as on the github page linked above, but I make a few assumptions. For example, you’re using a decent version of Powershell and you added Git to your path as instructed in my last post.

git clone
Set-ExecutionPolicy RemoteSigned

What does this do?

  1. First we get the code. We’ll talk more about git clone later.
  2. Next we set an execution policy. This might already be set. You could use Get-ExecutionPolicy to find out, but a set is quicker than a check plus a set.
  3. Finally we run the install script that is in the directory that git clone created.

If you still have that “demo” dir/repo we created last time, you can cd into it, change some files, and see the fruits of our labor!


If you’ve been using TFS, SVN, Fortress, or Visual SourceSafe, you’ve probably become accustomed to Visual Studio deciding what goes into source control and what doesn’t. Add a file to the project? That’s included. Build? Those binaries are not.

Git is file system based, which means if it’s a file, it’s included. How can we prevent junk from getting into our repository? Tell Git to ignore what doesn’t belong!

I can’t take credit for the most awesome .gitignore file I’ve seen. That belongs to Madhi Taghizadeh, and you can get it here.

Note that I’ve been using this handy dandy trick to make projects automatically restore NuGet packages before each build. If you do this as well, you probably want to kill the two negations at the bottom of the file that tell Git to include NuGet package DLLs.



You may not fully appreciate this one until we talk about branching, merging, and the strategies surrounding this topic, but let’s get it setup anyway. You can wait and do this later (after you’ve seen why you’ll want it), or you can trust me and get this out of the way Winking smile

First, we need to collect two dependencies that gitflow utilizes.

Now, from the command line

git clone --recursive
cd gitflow

So what does this do?

  1. First, get some code again. Do not forget the –recursive flag!
  2. Change to the gitflow directory that git clone just created
  3. Run the installation

What’s Next?

Like I said, what gitflow does and why you’ll want it will come into play later, as we explore some of the more popular branching strategies in the Git universe. In the next post, we’ll learn how Git differs from SVN, TFS (or heaven forbid Visual SourceSafe), and take a look at the strategy upon which gitflow was based.

Sneak Peek

Alright…if you’re already familiar with Git but not with gitflow, check this out.



About David Ruttka

I've been "making computers do things" since I first saw King's Quest on a 286 PC in the mid-80's, but I turned it into a career just over a decade ago. While the majority of my experience has been on the Microsoft stack (C#, .NET, ASP.NET), I've recently been diving deeper into JavaScript and exploring the Ruby universe. Occasionally, I'll do a public speaking gig or write a blog post. When I'm not coding, I enjoy spending time with my family, watching hockey, and playing the occasional video game. You can also find me on Stack Overflow, Google Plus, and Twitter. Microsoft Certified Programming in HTML5 with JavaScript and CSS3 Specialist; MCPD Windows Developer 3.5
This entry was posted in Development and tagged , , , , , , , . Bookmark the permalink.


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s