views:

166

answers:

6

A noob here.

I have a personal Macbook and I want to use Git to track the changes etc. I want to just init a repo on my macbook and work there. Is this a good idea?

What if: I have a main repo somewhere in my Macbook HD, like, /Users/user/projects/project1 and clone it to another area on my macbook where I actually perform development? But there is a lot of redundancy in this.

I am a little confused and want to know what are the usual steps folks take in a similar personal development environment.

Thanks a lot.

+1  A: 

I use Hg instead of Git but the workflow you just describes more or less what I do.

The only thing I'd add is that I got a Windows Live Mesh account since it auto-syncs to the cloud and works on Mac as well (its still Beta but I haven't had much trouble) but there are probably other cloud storage providers.

Anyway, I create a core repository inside the Live Mesh folder and then clone from that to a working directory. The code on my Mesh account is always a last known good and I often will have 2 or more working clones of the same project on a given machine where I am trying different approaches to solve the same problem.

loarabia
+2  A: 

It's fine to just git init where your working, you don't need to clone it to another area.

Just remember you still need to back up.

dalton
+2  A: 

I want to just init a repo on my macbook and work there. Is this a good idea?

Yes, that is a good idea. That is exactly what I do.

What if: I have a main repo somewhere in my Macbook HD, like, /Users/user/projects/project1 and clone it to another area on my macbook where I actually perform development? But there is a lot of redundancy in this.

Your repository will live in /Users/user/projects/project1/.git/

You then checkout the repository to the directory /Users/user/projects/project1 and work on it there. You don't need to clone anything.

Jay
Just a question: When I commit the first time after `git init` in the current directory, I really don't need to checkout anything, right? I mean my Master branch would have already been checked out. Now, if I create a new branch, that I need to checkout (but in the same directory). Please let me know if I need to rephrase the question. :) Thanks.
AJ
Yes, that is correct. You can also use the checkout command to checkout older commits. For example, maybe you deleted some code and now you want to look at it again.
Jay
+2  A: 

I find this flow very good for personal and group development: http://nvie.com/git-model

This guy even developed additional git commands to work with this flow (http://github.com/nvie/gitflow/tree/0.2). You should try it out yourself!

Eimantas
Thanks. This is a nice flow-chart.
AJ
+1  A: 

Just make the one repo. With git's powerful branching, you don't need two repos on the same machine. A repo somewhere else is always a good idea, in case something happens to your computer.

Amadan
+1  A: 

I like to have a bare repo cloned somewhere else. It allows me to push without any problem.
I will have:

  • a bare repo cloned on my local drive, always accessible, preferably linked to some online synchronization service like DropBox.
  • a cloned repo as a bundle (one file), where I can also push, but located on an USB key (that way I have also a backup which doesn't rely on Internet access)

So even for solo development, cloning make sense provided it doesn't involve only your local desktop, but also some external storage.

VonC
I did not know about bare repos. Thanks.
AJ