Saturday, February 12, 2011

Setting Up a Git Prototype

I'm exploring git to see how it might work for my company. I've got git installed and I need to know a couple things:

  • How can I set up a git server on my computer to act as my central repo?
  • I'm trying to figure out how to manage my workflow with just the GUI on Windows (using the GUI is a requirement). How do I take a bunch of files in a folder and get them into my GIT repo?

If there's a good tutorial for each item I'm plenty happy looking there instead if you can point me in the right direction. Thanks!

  • In order to get started, you're going to have to use the command line.

    First you'll want to initialize a local repo in place. cd to the folder your files that you want under version control and issue:

    git init
    

    You've now initialized a git repository in that foleder. Now you need to add all of the files to it:

    git add .
    git commit -m "Initial Import"
    

    Now cd to the parent folder of your local repository. You're going to want to make a "Bare" clone of the repository to act as your central repo. Issue the following command:

    git clone projectFolder/ ProjectName.git
    

    ProjectName.git will be created with only the version control repository. Move this folder to wherever you want to act as your central repository. From there on out, you can clone and pull from the central repository and push to the central repository.

    To clone from a central repository via SSH:

    git clone [user@]host.xz:/path/to/repo.git/
    

    Or, if your repo is on a network share

    git clone D:/path/to/repo.git/
    

    This is also doable from the GUI client for checking out and pushing changes back to the repo.

  • If using a GUI is a requirement you'll have some problems with git. Even on command line git isn't as good as it is on other unixes.

    The only thing that support git on a GUI is the git plugin for Eclipse, but it's far away from the real thing. I like git very much but for that heavy Windows usage I would recommend Subversion.

0 comments:

Post a Comment