tags:

views:

560

answers:

4

Hi,

Recently I have learned the basics concepts of Git. We did use a bit of git-svn to get familiar with using it. I would like to start my first "true" project on git along with my friends.

Therefore I would like to ask you what are the best practices of using Git in general, and if there are any pitfalls that SVN familiar developer my get into?

+2  A: 

Collaboration among more than one developer is probably best done using a central "bare" repository, which is roughly analogous to a repository in Subversion. Sharing changes between two or more people with only their own repositories, is difficult and prone to error. Also, using a central repository will feel more comfortable coming from a Subversion background.

One great thing about Git is that you can easily have more than one "common" repository. I have my development set up so I keep a set of bare repositories on one server that I usually interact with ("origin" for most of my projects), but for some projects I also push the whole thing up to GitHub. I don't have to choose which one is the single central repository, I can pull and work from the GitHub repository and later push to my own copy.

Greg Hewgill
+1  A: 

See this SO question from earlier today.

Doug Currie
+1  A: 

Getting an account on GitHub and using it to maintain some working, non-essential code is a great way to find your own best way to do it. I've found the Network Visualizer very helpful for "seeing" what's happening as I try various things with git.

Rich Apodaca
+2  A: 

There are pitfalls to thinking that Git is SVN with a bad accent. This recent question demonstrates two pitfalls in Git which could make sense in SVN:

  1. Thinking that rebase in Git should be replaced with merge. Merging with someone else's changes will sometimes result in many unnecessary merge conflicts that rebase avoids.
  2. Pushing a feature branch to a remote repository and then merging there gets even worse results.

Another major pitfall is expressed well in the Git FAQs under "Unexpected Beharviour":

    A quick rule of thumb is to *never* push into a repository 
    that has a work tree attached to it, until you know what you are doing.

Somewhere in the Man pages it is gently explained that this can "lead to unexpected results." Like losing all of someone else's work.

This Git SVN Crash Course will ease your transition to Git while still thinking in SVN.

Paul