Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick guide to get started using Git + GitX with Xcode projects on the mac?

Using Git on the mac feels like a huge pain, and the Git documentation is just huuuuuuuuge. Maybe someone has a top secret blog article or even screencast to share, that explains the basics fairly simple and quickly?

  • Creating a repository. Big pain.

  • Opening that repository with GitX: Pain.

  • Working in Xcode and then committing changes: No idea, probably big pain too.

  • Cloning the repository to a few other developers with their own macs so they can start collaborate on the project: Oh man, my head explodes... need a doctor!

  • Merging those cloned repositories back somehow, so everyone gets an updated repository with the changes of anyone else: Red alert!

Right now I feel I'll need a month to grok it. Would be SO glad if someone can point out really helpful resources that don't force me to read for some days... or is there a great and thin book that explains this madness?

like image 641
Proud Member Avatar asked Nov 30 '10 17:11

Proud Member


People also ask

How do I open a Git project in Xcode?

Open your XCode application. Go to the Source Control Tab of XCode and go to Clone. Enter the repository URL you copied in the above step in the search bar at the top of the dialog and hit the Clone button. It will now ask you to sign in to your github account where the given repository is made.

How do I add a Git repo to Xcode?

Go to Source Control in Xcode and select Projectname -- master, then Configure... In the Address field, paste the Git clone URL for your repo copied in the previous step. Select Add Remote, then select Done to finish creating the origin remote for your local Git repo.


2 Answers

Git is absolutely enormous, and you could certainly spend that month learning its processes, but you can stick to some basic concepts and end up with a really great workflow. I use the command line, as it allows you stick to these basics, and expand out if you need to. These basic commands are "pull", "push", "init", "commit -am "message"". Later, you can read about branches and rebasing at gitref.org.

As a mac Xcode + git user; I definitely recommend DTerm to make life easy. One key command brings up a floating terminal window, CDed to the directory of the file that's currently active. In XCode, this means that you'll be in a git-controlled directory immediately.

So, my workflow --

  1. Use "git init" in the terminal to create a repository
  2. Create github repository
  3. follow github instructions to associate the two
  4. When working in my project, press Shift-Command-Enter to bring up a floating terminal window
  5. type "git commit -am "commit message" to commit all current changes
  6. Same key combo plus "git pull" or "git push" for pulling in changes from code repository or pushing changes to code repository, respectively

I find that the command line allows a much easier working relationship with git than GitX, especially if you're using something like DTerm.

For a great reference, check out gitref.org. Good luck!

like image 51
Sam Ritchie Avatar answered Nov 03 '22 06:11

Sam Ritchie


Launch a terminal window.

Creating a repository:

cd project-dir
git init

Opening the repository in GitX:

cd project-dir
gitx

Committing changes:

git status
git add .  # or individual files
git commit

(it's a good idea to set up a .gitignore file from the beginning.)

Read the Pro Git book or look at some of the video tutorials at git-scm.com to get started quickly. The one by Linus is mostly a description of the implementation plus rant against other VCSs; the second video is really useful.

like image 22
Fred Foo Avatar answered Nov 03 '22 08:11

Fred Foo