A noob here.
I have a perso开发者_JS百科nal 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.
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.
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.
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!
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.
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.
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.
精彩评论