====== Git =======
Dreamhost supports git. I just created a git folder to keep my private repositories there. Now git is different from subversion, you don't have to do an initial check out from remote server and start working on that. What you have to do instead is do your things locally and then push them to the remote server.
Here are the steps considering you already installed git on your Leopard:
* Create your iphone project on XCode. Let's assume it's IContact.
* Go to this folder in terminal. Inside the folder:
git init
git add .
git commit -a -m "Initial import"
git remote add origin ssh://yourusername@yourserver.com/~/git/IContact.git
* now before pushing this, you have to have the same git repo on the remote. So ssh to your server and in your git folder:
[patton]$ cd git
[patton]$ mkdir IContact.git
[patton]$ cd IContact.git/
[patton]$ git --bare init
* now you are ready to push this to remote server.
git push origin master:refs/heads/master
couple of things about the configuration regarding git:
**git status**
user:IContact user$ git status
**git remote add**
It's easy to add the remote repo to your remote so that you can access it easily later.
$ git remote add ssh://myserver.com/~/git/IContact.git
then:
$ git push
**git clone**
$ git clone ssh://myserver.com/~/git/IContact.git
**Commits.** Each commit has an author and a committer field, which record who and when created the change and who committed it (Git is designed to work well with patches coming by mail - in that case, the author and the committer will be different). Git will try to guess your realname and email, but especially with email it is likely to get it wrong. You can check it using git config -l and set them with:
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
**Colors.** Git can produce colorful output with some commands; since some people hate colors way more than the rest likes them, by default the colors are turned off. If you would like to have colors in your output:
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
Now, one thing specific about xcode, build folders and some unnecessary files that has been changed each time we compile the program and we don't want to commit those remotely. We don't need them. So we can use .gitignore to ignore those files when committing.
#Ignore the Mac OS X .DS_Store files
.DS_Store
#Ignore user-specific settings
*.mode1v3
*.mode2v3
*.pbxuser
*.perspectivev3
#Ignore textmate build errors
*.tm_build_errors
#Ignore temp nibs and swap files
*.swp
*~.nib
#Ignore the build, since we don't want archived builds
build
Put this content in a file called .gitignore and place it in the root of $GIT_DIR. If you wish to create a local .gitignore that applies to all your git repositories, place it in ~/ and edit ~/.gitconfig to reference the file
[core]
excludesfile = /Users/yourusername/.gitignore
**Git tips**
***always pull on a "clean" tree** meaning first commit and then git pull. if merge goes bad you can always abort it.
***pull is used in two ways:** 'git pull' (fetch + merge some default branch) or 'git pull '.
***a remote nick is** a short form for a URL; you can create such convenient short forms using the "git remote add" command, or clone will do it automatically and call it "origin".
***'git branch -r'** displays known mirrored branches (known as remote (tracking) branches).
**References:**
*[[http://git.or.cz/course/svn.html | http://git.or.cz/course/svn.html]]
*[[http://www.kernel.org/pub/software/scm/git/docs/gitignore.html | http://www.kernel.org/pub/software/scm/git/docs/gitignore.html ]]
*[[http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects]]
*[[http://code404.com/using-gitignore-with-xcode-for-iphone-development | http://code404.com/using-gitignore-with-xcode-for-iphone-development]]