Goals:
- I have some source code that I need to share between a desktop and laptop sporadically.
- When I'm working on the code on the laptop (potentially disconnected from any network for several days), I want all the same scm style capabilities (tagging, branching, roll-backs) that I get when I'm working on the desktop.
- I don't want the overhead of maintaining a server securely or paying for a hosted solution.
- I'll only ever be actively developing on either the laptop or desktop at any given time, so merges are no concern [for now].
After watching the ever opinionated Linus, a few git casts, and reading Wincent's summary, I was gung-ho convinced GIT could do the job.
GIT Recipe #1. One-way pushes between two trusted peers.
Given:
Base dir
|-> Myproject dir
Step 1. Create a GIT repo and index on machine #1 for your project.
machine1$ cd /myproject
machine1$ git init
machine1$ git add .
machine1$ git commit
Step 2. Start the git server component on Machine #1. Warning this allows fully anonymous unauthenticated access, so only do this in a secured LAN environment -- and personally, I would only do it for short sporadic bursts of time even in that environment. For a more secure option (i.e. - apache/ssh/etc), see the git docs (it's a bit more work).
machine1$ git-daemon --verbose --export-all --enable=receive-pack --base-path=/parentof/myproject/dir
Step 3, clone the repo to machine 2.
machine2$ git clone git://machine1/myproject
To do work on machine 1, and send the updates to machine 2
On Machine 1 (origin repo), remove a file and commit the change.
machine1$ vi README.txt
machine1$ git add README.txt machine1
machine1$ git commit
On Machine 2, pull those changes across
machine2$ git pull
To do work on machine 2, and send the updates to machine 1
Make some change . . .
machine2$ vi README.txt
machine2$ git add README.txt
machine2$ git commit
Push those changes over to the origin repo
machine2$ git push
Then, on Machine A [be careful not to have any local changes], to get those changes into your working copy:
machine2$ git checkout -f
GIT Recipe #1. One-way pushes between two trusted peers.
Given:
Base dir
|-> Myproject dir
Step 1. Create a GIT repo and index on machine #1 for your project.
machine1$ cd /myproject
machine1$ git init
machine1$ git add .
machine1$ git commit
Step 2. Start the git server component on Machine #1. Warning this allows fully anonymous unauthenticated access, so only do this in a secured LAN environment -- and personally, I would only do it for short sporadic bursts of time even in that environment. For a more secure option (i.e. - apache/ssh/etc), see the git docs (it's a bit more work).
machine1$ git-daemon --verbose --export-all --enable=receive-pack --base-path=/parentof/myproject/dir
Step 3, clone the repo to machine 2.
machine2$ git clone git://machine1/myproject
To do work on machine 1, and send the updates to machine 2
On Machine 1 (origin repo), remove a file and commit the change.
machine1$ vi README.txt
machine1$ git add README.txt machine1
machine1$ git commit
On Machine 2, pull those changes across
machine2$ git pull
To do work on machine 2, and send the updates to machine 1
Make some change . . .
machine2$ vi README.txt
machine2$ git add README.txt
machine2$ git commit
Push those changes over to the origin repo
machine2$ git push
Then, on Machine A [be careful not to have any local changes], to get those changes into your working copy:
machine2$ git checkout -f
Bottom-line: The big benefit here is that I can commit, tag and branch at will on either machine without them being connected, and then sync them up when there is connectivity. There are git workflows which allow for that capability with larger groups, but I personally only need this one workflow (working while disconnected) to function at the moment.
Some of the better GIT Resources I've found:
Some of the better GIT Resources I've found:
- http://rails.wincent.com/wiki/Git_advantages
- http://www.youtube.com/watch?v=4XpnKHJAok8
- http://www.sourcemage.org/Git_Guide
- http://www.gitcasts.com
- http://www.rockstarprogrammer.org/post/2008/apr/06/differences-between-mercurial-and-git/
- http://cheat.errtheblog.com/s/git
- http://cheat.errtheblog.com/s/git_usage/
- http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png
- http://code.google.com/p/git-osx-installer/
- http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
- http://google-opensource.blogspot.com/2008/05/develop-with-git-on-google-code-project.html
- http://osteele.com/archives/2008/05/my-git-workflow
- http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png
- http://www.dekorte.com/blog/blog.cgi?do=item&id=2539
No comments:
Post a Comment