问题
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.
回答1:
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:
- Open the Organizer
- Click on the Projects icon
- Click on your project
- Click on the Snapshot you want to compare
- Click on the "Export Snapshot" icon at the bottom
- 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
回答2:
There is no vs here. You can use GIT in xcode http://repeatgeek.com/tools/using-git-with-xcode-part-i/
来源:https://stackoverflow.com/questions/13531655/git-vs-xcode-snapshot