Git and XCode - Nsspain2013
-
Upload
aprende-git -
Category
Technology
-
view
1.254 -
download
0
description
Transcript of Git and XCode - Nsspain2013
Git and XCodeAlfonso Alba@aprendegit
martes, 17 de septiembre de 13
martes, 17 de septiembre de 13
How?
martes, 17 de septiembre de 13
Minimum man-hour
martes, 17 de septiembre de 13
• If you commit often:
• Your commits will be smaller
• Your history will be more readable
• It will be easier to cherry-pick or revert
martes, 17 de septiembre de 13
Commit often
XCode 4 XCode 5
ALT-CMD-C
martes, 17 de septiembre de 13
martes, 17 de septiembre de 13
• If you do not write good commit messages
martes, 17 de septiembre de 13
Write good commit messages
XCode 4 XCode 5
You cannot commit empty messages
martes, 17 de septiembre de 13
• If you commit only related changes
• Your history will be more readable
• It will be easier to find bugs
• It will be easier to cherry-pick or revert
martes, 17 de septiembre de 13
Commit related changes
You cannot commit chunks
XCode 4 XCode 5
martes, 17 de septiembre de 13
• If you use branches
• It will cost you less effort to switch context
• It will be easier to do code review
• You will try new things more often
• It will be easier to refactor
martes, 17 de septiembre de 13
Use branches
Have you ever tried to change a branch in XCode?
XCode 4 XCode 5
martes, 17 de septiembre de 13
THE Problem:Merging
martes, 17 de septiembre de 13
“My” experience with git is:
martes, 17 de septiembre de 13
• You will have problems with
• xcuserdata
• xcworspacedata
• Core Data Models
• .xib files
• Story Boards
• Assets
martes, 17 de septiembre de 13
How to deal with / mitigate
THE problem
martes, 17 de septiembre de 13
• xcuserdata
• Do not include this file in your rempository
• Use a good .gitignore file
• http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
martes, 17 de septiembre de 13
• xcworkspacedata
• ... you will have to resolve conflics manually
martes, 17 de septiembre de 13
• Core Data Models
• Create the models on code(Daniel Eggert contribution)
• Use migrations
•Test your models
• Sessions and Workshops during the conference!!
martes, 17 de septiembre de 13
• XIB and Story Boards
• ... well, if it was easy our life would be much boring!!
martes, 17 de septiembre de 13
Do not use xib files or story boards:
Yes, you will have to write code
martes, 17 de septiembre de 13
This is my code, don’t you dare touch it!!
martes, 17 de septiembre de 13
• If you want to use Interface Builder
• Split the story boards
• Use xib files instead of story boards
• Agree on a workflow and/or protocol
• Good team comunication
• Use file locking (subversion)
• git checkout --theirs / git checkout --ours
martes, 17 de septiembre de 13
DEMO: git checkout-index
martes, 17 de septiembre de 13
baboonhttps://github.com/SeyZ/baboon
martes, 17 de septiembre de 13
baboon
baboon client
working copy
baboon client
working copy
bare repo
martes, 17 de septiembre de 13
Other tools
martes, 17 de septiembre de 13
• git
• Interactive staging
• git-bisect
• git filter-branch / BGF repo cleaner (http://rtyley.github.io/bfg-repo-cleaner/)
• Hooks
• Incremental merging: http://softwareswirl.blogspot.nl/2013/05/git-incremental-merge.html
• sort-Xcode-project-filehttp://danieltull.co.uk/blog/2013/09/05/easier-merging-of-xcode-project-files/(Chris Eidhof contribution)
• SemanticMerge http://www.semanticmerge.com/
martes, 17 de septiembre de 13
Is git your tool?
martes, 17 de septiembre de 13
• Git is not perfect
• BAD for binary files
• No folders
• Guess file renaming
• Too flexible
• Steep learning curve
• No file locking
martes, 17 de septiembre de 13
Access Control
martes, 17 de septiembre de 13
No history rewrites
martes, 17 de septiembre de 13
Undo
martes, 17 de septiembre de 13
• Enterprise tools
• Github Enterprise
• Stash
• Sourceforge
• PlasticSCM
martes, 17 de septiembre de 13
One more thing...
martes, 17 de septiembre de 13
Git is not a backup system
martes, 17 de septiembre de 13
Thank you!!
martes, 17 de septiembre de 13