git vs xcode snapshot

扶醉桌前 提交于 2019-12-31 22:40:13

问题


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:

  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




回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!