Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git vs xcode snapshot

I am learning to program in iOS thru the itunesU videos and have been using xcode. I had found in xcode the feature to create snapshots which I have used to take snapshots of my project at each major milestone so far.

Then I come to the chapter on using git for version control and followed their instructions to the point of "git init", which gave this response "Reinitialized existing Git repository in /Users/username/Developer/Calculator/Calculator/.git/" instead of the "initialized empty git depository in /Users/...etc", which led me to think snapshot has already done it.

My question is: have I thus screwed up in any way the snapshots I had created in xcode before I ran "git init"? Thanks.

like image 820
rockhammer Avatar asked Nov 23 '12 15:11

rockhammer


1 Answers

I think you just encountered an instance of the message not really meaning what it says.

Snapshots & git repositories are totally separate. Snapshots are stored in:

~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage

By default, a project git repository is in:

$SRCROOT/.git

$SRCROOT is your project's "root" folder.

To me, it's not really a vs. or a "one or the other". I use both. I have XCode set-up to take snapshots after every build succeeds:

Xcode->Preferences...->Behaviors->Build->Succeeds->Create Snapshot

and commit to git:

Xcode->File-Source Control->Commit...

after every "big change" is complete.

This way, I can manage the "big stuff" (branches, merges, rollbacks) using git and investigate the small "what did I just break?" stuff with Snapshots. I rarely have to rollback a Snapshot. Off hand, the only times I can recall have been botched global Search & Replaces.

The only disadvantage is that Xcode won't let you compare the current code to the previous Snapshot using the difference editor. To compare the current code with a previous Snapshot, you have to:

  1. Open the Organizer
  2. Click on the Projects icon
  3. Click on your project
  4. Click on the Snapshot you want to compare
  5. Click on the "Export Snapshot" icon at the bottom
  6. Resize the drawer to a useful width and compare

Comparing Snapshots aren't as easy as comparing previous .git versions, but it has saved me a bunch of time when a small change has broken something in the current build.

Ray

like image 175
RayInNoIL Avatar answered Oct 20 '22 02:10

RayInNoIL