Thursday, August 28, 2008

setup git




Setting up a new remote git repository is easy.

Here's my own personal howto:


(I) - Set up a git project
===========================

http://www.kernel.org/pub/software/scm/git/docs/tutorial.html

1) Make an empty project dir

cd test
mkdir info
cd info

2) Initialize this directory as a git project

git init

3) Copy all the files over that you want to use to start the project

cp ~/test/info/diary.txt .

4) Add these files to the index

git add .

5) Commit these changes

git commit -m "Initial commit"


(II) - Setting Up a Shared Repository
=====================================

1) Make a new directory where the shared repository will live

mkdir ~/mDEV/info
cd ~/mDEV/info

2) Initialize the shared repository

git --bare init --shared
git --bare fetch /home/sness/test/info master:master


(III) - Interacting with the Shared Repository from a remote machine
====================================================================

1) Clone the project from the server

git clone q:/home/sness/mDEV/info

2) Update the project with the latest files (equivalent to "cvs update")

git pull origin

3) Add the files that have changed

git add file1 file2 file3

4) Commit the files

git commit

5) Push the changes to the server

git push origin

or if there is more than one branch on the server:

git push origin master