<?xml version="1.0" encoding="utf-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
      <title>Category: Programming | Mitja Bezenšek</title>
      <id>http://bezensek.com/</id>
      <link href="https://bezensek.com/blog/categories/programming/atom.xml" rel="self"/>
      <link href="https://bezensek.com/"/>
      <updated>2014-03-06T21:30:35+01:00</updated>
      <author><name>Mitja Bezenšek</name></author>
      <entry>
      <title type="text">Using Git with Visual Studio</title>
      <id>http://bezensek.com/blog/2014/03/06/using-git-with-visual-studio</id>
      <link href="https://bezensek.com/using-git-with-visual-studio/"/>
      <updated>2014-03-06T21:30:35+01:00</updated>
      <published>2014-03-06T21:30:35+01:00</published>
      <content type="html">&lt;p&gt;Source code needs to be under &lt;a href=&quot;https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/&quot;&gt;version control&lt;/a&gt;, period. When it comes to deciding which system to use, &lt;a href=&quot;https://en.wikipedia.org/wiki/Git_%28software%29&quot;&gt;Git&lt;/a&gt; is one of the options. There are many &lt;a href=&quot;https://stackoverflow.com/questions/871/why-is-git-better-than-subversion/875#875&quot;&gt;heated debates&lt;/a&gt; which one is the best, but let’s not go into that. All of them do their job, so it mostly comes down to personal preference. I like Git.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://bezensek.com/_images/da65c4eb19011063-697.webp 697w&quot; sizes=&quot;(max-width: 540px) calc(100vw - 66px), (max-width: 760px) calc(100vw - 90px), (max-width: 898px) calc(100vw - 158px), 740px&quot;&gt;&lt;img src=&quot;https://bezensek.com/img/gitflow.png&quot; alt=&quot;Gitflow&quot; width=&quot;697&quot; height=&quot;397&quot; decoding=&quot;async&quot; loading=&quot;eager&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://nvie.com/posts/a-successful-git-branching-model/&quot;&gt;Image source&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;!-- more --&gt;
&lt;h2 id=&quot;git-in-visual-studio&quot;&gt;Git in Visual Studio&lt;/h2&gt;
&lt;p&gt;In January 2013 the Visual Studio team &lt;a href=&quot;https://devblogs.microsoft.com/bharry/git-init-vs/&quot;&gt;announced&lt;/a&gt; that Visual Studio will have Git support. You will need Visual Studio 2012 Update 2 at least.&lt;/p&gt;
&lt;p&gt;I have tried the extension but I don’t recommend it just yet. It is still lacking many features and it seems very rushed. In a few iterations it might be worth to install it but for now I would say stay away. This is why I decided to discuss possible alternatives, namely: command line, Git Extensions and Source Tree.&lt;/p&gt;
&lt;h2 id=&quot;command-line&quot;&gt;Command line&lt;/h2&gt;
&lt;p&gt;So how can you start using Git? The easiest way in terms of required software is the command line. First of all you need to &lt;a href=&quot;https://git-scm.com/install/&quot;&gt;download&lt;/a&gt; and install Git. After that you just need to &lt;a href=&quot;https://git-scm.com/docs&quot;&gt;read the documenation&lt;/a&gt; and you can immediately start using it from the command line.&lt;/p&gt;
&lt;p&gt;And that is a good way to start using it if you are not familiar with it. Since you have to type in all the commands you will think twice if this is the right thing to do. And you won’t get overwhelmed by all the possible commands. You will learn one or two commands and really get to know those. For starters you just need &lt;code&gt;init&lt;/code&gt; and &lt;code&gt;commit&lt;/code&gt;. Soon after that you will want to save the source code on another computer, not only on your own. That’s when &lt;code&gt;remotes&lt;/code&gt;, &lt;code&gt;push&lt;/code&gt; and &lt;code&gt;pull&lt;/code&gt; come into play. And when you start to work in a team, sharing the code, you will need to learn about &lt;code&gt;branches&lt;/code&gt; and maybe even about branching models like &lt;a href=&quot;https://nvie.com/posts/a-successful-git-branching-model/&quot;&gt;GitFlow&lt;/a&gt; for example.&lt;/p&gt;
&lt;p&gt;Does this work with Visual Studio. Absolutely. That’s why I don’t understand why so much fuss about Git being incorporated into Visual Studio. Many developers only use git from the command line. Some would even argue that that’s the only way to use it. I understand that commiting directly from the IDE is probably faster and that visual representation of the branch tree is nice. However, writing a few additional lines every day sholdn’t keep you from using Git!&lt;/p&gt;
&lt;h2 id=&quot;git-extensions&quot;&gt;Git Extensions&lt;/h2&gt;
&lt;p&gt;The next option is a Visual Studio extension called &lt;a href=&quot;https://gitextensions.github.io/&quot;&gt;Git Extensions&lt;/a&gt;. It’s the only one of the three alternatives that I mention that is completely integrated into Visual Studio. After installing you get an additional toolbar in your workspace:&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://bezensek.com/_images/e3e42831f679419a-297.webp 297w&quot; sizes=&quot;(max-width: 540px) calc(100vw - 66px), (max-width: 760px) calc(100vw - 90px), (max-width: 898px) calc(100vw - 158px), 740px&quot;&gt;&lt;img src=&quot;https://bezensek.com/img/gitExtensions.png&quot; alt=&quot;Git Extensions toolbar&quot; width=&quot;297&quot; height=&quot;28&quot; decoding=&quot;async&quot; loading=&quot;lazy&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;The most used commands are directly exposed on the toolbar, but you can open up a window where all git commands are only a click away. You can also see your branch tree and commit messages.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://bezensek.com/_images/e6b970e39ebc6531-1017.webp 1017w&quot; sizes=&quot;(max-width: 540px) calc(100vw - 66px), (max-width: 760px) calc(100vw - 90px), (max-width: 898px) calc(100vw - 158px), 740px&quot;&gt;&lt;img src=&quot;https://bezensek.com/img/gitExtensions2.png&quot; alt=&quot;Git Extensions window&quot; width=&quot;1017&quot; height=&quot;668&quot; decoding=&quot;async&quot; loading=&quot;lazy&quot;&gt;&lt;/picture&gt;
&lt;sup&gt;&lt;a href=&quot;https://gitextensions.github.io/&quot;&gt;Image source&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;If you like the integrated way you might also want to check &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=yysun.GitSourceControlProvider&quot;&gt;Git Source Control Provider&lt;/a&gt; which allows you to see the status of your files in the solution explorer. It makes it easy to see which files were newly added, which were changed,…&lt;/p&gt;
&lt;p&gt;I’ve had some minor problems with Git Extensions. Sometimes the window crashed if I had it opened for too long. I also ran into some authentication problems when pushing to Bitbucket. This problem was solved by manually running their git-credentials-windstore executable. Apart from that I quite liked it. It is really rich with options and possibilities and also works remarkably well.&lt;/p&gt;
&lt;h2 id=&quot;source-tree&quot;&gt;Source Tree&lt;/h2&gt;
&lt;p&gt;The last option is a standalone desktop application called &lt;a href=&quot;https://www.sourcetreeapp.com/&quot;&gt;Source Tree&lt;/a&gt; from Atlassian. While the Mac version has been around for quite some while they have released the Windows version not so long ago.&lt;/p&gt;
&lt;p&gt;I must admit that lately I’ve been using Source tree the most. I really like the nice user interface, it is also very easy to keep track of multiple projects. And there is another little gem: it has support for Gitflow. So you can easily start new features, hotfixes, releases.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://bezensek.com/_images/13b10d0ab5fdfc31-291.webp 291w&quot; sizes=&quot;(max-width: 540px) calc(100vw - 66px), (max-width: 760px) calc(100vw - 90px), (max-width: 898px) calc(100vw - 158px), 740px&quot;&gt;&lt;img src=&quot;https://bezensek.com/img/sourceTree2.png&quot; alt=&quot;Gitflow options inside of Source Tree&quot; width=&quot;291&quot; height=&quot;358&quot; decoding=&quot;async&quot; loading=&quot;lazy&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;So until the Visual Studio team improves their extension I think any of the three proposed options is better. Once again it will come down to personal preference. Do you want visual control or do you like command line? Do you want to have integration with Visual Studio or is a standalone application also ok?&lt;/p&gt;
</content>
    </entry>
    </feed>