Wednesday, July 20, 2011

Using Git, XCode4 and Unfuddle together

  1. With XCode4 supporting Git out-of-the-box it is highly encouraging to know that any endeavor that you "the developer" might embark on ... will benefit from a default development branch (on your local box) known as master repository (unless you explicitly de-select a checkbox in XCode4 when creating your project).
  2. As your single-developer project gains a coherent enough form for you to want to share it with other developers ... Unfuddle will pop into the picture because it provides: (a) Git hosting, and (b) it is free for upto 2 developers. This is the perfect setup for figuring out if Git and XCode4 are the right fit for you.
    • A lot of folks who make use of GitHub hosting (your source code is open to the world) seem to be concerned about how XCode4 doesn't live up to their expectations because it doesn't provide an automated process or any clear cut instructions for configuring and pushing the local master-repo over to a remote upstream repository (lets call it origin-repo) when this phase in their development life-cycle finally arrives.
    • Well the instructions over @ Unfuddle couldn't be more direct and clear-cut, they get the job done in under 10 minutes flat. They are suited exactly for a project where a local master-repo already exists and you want to push it to a remote origin-repo.
    • After the push setup is completed and your team member has cloned the origin-repo onto their own dev machine as a master-repo, you are ready to roll.
  3. Lets say the n00b member makes a change to their local files. They can quickly find out what has changed using
    git status
  4. Now the n00b wants to commit the changes, then they can use
    git commit -m "comment"
  5. But wait, this only committed the changes to the local master-repo on the n00b's machine, next to get this pushed over to the origin-repo use:
    git push git@subdomain.unfuddle.com:subdomain/abbreviation.git
    ... where subdomain and abbreviation must be replaced with values appropriate to your account and repository.
  6. Now lets say you realize that it doesn't make much sense to have the *.xcodeproj files/folders under source control as their contents might differ based on the machine they are on, well then:
    git rm --cached <file>
    would remove file from version control, while keeping it in the working repository. And to avoid from ever mistakenly adding it back to source control, just add a .gitignore file and inside it put the expression to ignore the file/folder in question.
  7. Then use
    git commit -m "comment"
    for putting the change into master-repo

  8. And
    git push git@subdomain.unfuddle.com:subdomain/abbreviation.git
    for pushing the change to the origin-repo

  9. Finally use
    git pull git@subdomain.unfuddle.com:subdomain/abbreviation.git
    to get everything back over to your own local master-repo

  10. Some common tasks that may crop-up once you move to a multi-dev env could be simple things like wanting to rename the project. For XCode4 this was a particularly simple yet difficult find for me. Apparently according to Konstantin Salavatov: in XCode4 clicking on the project name after selecting it, starts the process of renaming it. This is absolutely correct.

  11. Here's a set of links to keep close at hand for quick reference:
    • http://www.arlt.eu/blog/2009/12/01/importing-iphone-keys-p12-and-pem-into-snow-leopards-keychain/
    • https://git.wiki.kernel.org/index.php/GitCheatSheet

0 comments:

Post a Comment