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

5

5

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?

Murrhine answered 30/11, 2010 at 17:52 Comment(1)
If you describe creating a repository and opening it in GitX (essentially single commands) as a pain... I'm not sure what you're expecting a tutorial to fix.Putto
J
4

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!

Jovial answered 30/11, 2010 at 18:1 Comment(0)
C
2

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.

Crawl answered 30/11, 2010 at 18:2 Comment(0)
C
1

I used git under OSX for about 6 months (albeit not with Xcode). It's works a treat! But yes, it was a painful experience and a steep learning curve at times, especially when everybody else on the project are Windows developers (with more choice of git clients) and anti OSX (unwilling or unable to help). But it's well worth the effort in the long run. It's doable! Once you've got the basics, you'll find it's 10x better than say Subversion. Merges just work. Conflicts become more or less a thing of the past.

But my advice, forget GitX, it's crap. I started off with it, soon realised it doesn't do (or at least 18 months it didn't do) anything you can't easily do from the command line. It also does a whole lot less. So you end up in the terminal eventually anyway... and that's coming from someone who normally hates using the Terminal due to own incompetence! If you want a decent front end client, try Syntevo's SmartGit. Once I'd found that I quickly grew to love Git.

Also recommend reading the Pro Git ebook, mentioned by larsmans.

Crural answered 1/12, 2010 at 10:11 Comment(0)
F
1

Understanding the simplicity of Git is hard. If you have some experiences with other (centralized) version control systems, try to forget them and understand Git's basic concepts (objects, commits, branches,..). There are lot of books out there. I would recommend the short (30 pages long) Git from bottom up, it is free and very useful. Another free learning materials are at gitcasts. Pragprog and peepcode have also great books and screencasts. They are not free, but useful.

I use git with XCode for several months, and they work together. Although XCode hasn't git listed as a supported version control system, you can use git from the command line. I tried to use GitX, but never found it more useful then git from command line. Try it out, maybe it fits your habbits more.

For XCode I found this gitignore and gitattributes file useful for my projects:

.gitignore:

# xcode noise
build/*
*.pbxuser
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3

# osx noise
.DS_Store
profile

# other
.svn
*.swp

.gitattributes: *.pbxproj -crlf -diff -merge

Felt answered 1/12, 2010 at 10:58 Comment(1)
Do not mark *.pbxproj as -diff -merge. The pbxproj file format is designed to be sensibly diff-able and merge-able. When you get conflicts from multiple people adding files to the same build phase or group, just resolve those conflicts appropriately.Frig
K
0

I found the Git Book to be a really helpful resource. It explains the basics in simple terms and doesn't try to over-complicate things by going into the technical reasoning behind all the features. At least that's what I got from it.

Kashakashden answered 15/12, 2010 at 1:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.