Visual Studio - Using GIT and SVN

7,854

Solution 1

Git also has the ability to push to a subversion repository and pull from that repository so you could continue using git on all you projects and still use the SVN repositories when that is the projects source control.

The commands for it are all referenced with git-svn.

I found a pretty good tutorial about it.

http://viget.com/extend/effectively-using-git-with-subversion

Solution 2

While this doesn't address easy plugin switching, if you're comfortable using GIT via command line (as all the cool cats recommend), the Package Manager console window is just a Powershell prompt, so you have access to git *whatever* without switching source control providers.

You can also set up a custom 'External Tool' to open up a command-line prompt (or other shell) targeting the solution directory, so you can call normal git commands. Mapping it to a hotkey like CTRL+~ makes it easier to pull up.

You can also install the "Open Command Prompt" extension which does the same thing, and has some config options to make it a little easier than the external tool. Change the default hotkey from ALT+SPACE via 'DebuggerContextMenus.ScriptProject.OpenCommandLine.Default' (or the others listed).

Sidenote: if you do use git via commandline, consider setting up some convenience aliases...

Share:
7,854

Related videos on Youtube

WernerCD
Author by

WernerCD

Data Analyst Programmer (Primarily C#)

Updated on September 18, 2022

Comments

  • WernerCD
    WernerCD over 1 year

    Work uses SVN. I want to use GIT for private use. I was also exploring TFS, but it doesn't seem to cooperate with multiple collections, so I stopped looking into it.

    Currently I use AnkhSVN. I want to switch between it and the Microsoft GIT, on a per-solution basis.

    My question is... how do you smoothly use SVN on one project, git on the next, maybe even TFS on a third project (if I decide to look into it again)? Mercurial? etc

    How do you manage switching between those stacks easily in Visual Studio, because it doesn't seem like it's made for easy transition between technologies or configuring Solution A for SVN and Solution B for GIT.

    The only way I know is to use options and switch manually between technology stacks.

    Options: Source Control Options: Source Control

    • Ramhound
      Ramhound almost 10 years
      I am almost postive Visual Studio has add-ons for both SVN and GIT. That would be the best way.
    • WernerCD
      WernerCD almost 10 years
      @Ramhound VS comes with TFS & GIT built in. And I use AnkhSVN for SVN integration. But to switch, as far as I know, involves tools > options > Source Control > Switch. So it's VS wide. My question is how does someone work inside VS if they have different source controls to work in.
    • Ramhound
      Ramhound almost 10 years
      VS2013 does previous versions required a plugin. What is the problem with switching your source control? Your case is an edge case most people don't put projects under different source control under a single visual studio solution. In the future you should indicate within the question body itself the version of the software. Most people don't use tags properly so 99% of the time I don't even bother looking at the tags.
    • Áxel Costas Pena
      Áxel Costas Pena over 9 years
      @Ramhound OP says he wants to use Git in ONE SOLUTION and subversion in ANOTHER SOLUTION. What is weird with that? I'm f***ing surprised it can't be configured per-solution o.o
    • Ramhound
      Ramhound over 9 years
      @ÁxelCostasPena very professional response you made there...
    • WernerCD
      WernerCD over 9 years
      @Ramhound I'm mainly on VS2013 and this question does focus on that (although, the same thing applies to previous version). The issue is that you have to manually change the source control and restart Visual Studio every... single... time... you want to switch. VS2013 doesn't seem to like supporting multiple Version Control systems at the same time. SVN for work, Git for person, HG for school, etc... It'd be nice to not have to dig into settings, restart, dig, restart, rinse, lather repeat. It's made me curse on an occasion or two. I've mainly settled on explorer drop down menu's.
    • Ramhound
      Ramhound over 9 years
      I still maintain your use case is an edge case be sure to submit your feedback to MS for VS.Next though but VS2013 is unlikely to get this
    • WernerCD
      WernerCD over 9 years
      I understand, was thinking the same thing, and agree more so now that I'm looking back at the question. Often there are work-arounds to edge cases like mine (like me simply using Explorer and TortoiseGit/Svn/Hg drop down mouse-menu's in place of Visual Studios built in Source Control option).
  • WernerCD
    WernerCD almost 10 years
    Does this work within Visual Studio, or would that have to be command-line? I'm not averse to command-line but I am wanting to start inside of VS first.
  • usr-local-ΕΨΗΕΛΩΝ
    usr-local-ΕΨΗΕΛΩΝ over 9 years
    I think you may have to do only once "git remote add" to your SVN repository and then VS will start smoothly. I haven't tried this yet.
  • Darryl
    Darryl almost 7 years
    It's too bad git in powershell doesn't do the nice color coding you see in git bash. The color coding improves the usability of git command line quite a bit, IMO.