git

来源:互联网 发布:pages for windows 编辑:程序博客网 时间:2024/04/30 20:29
1、安装git,官网有安装教程
2、在新建项目到时候会有如下选项

如何在xcode中使用git


如果创建项目到时候,没有选择创建repository,需要以下步骤进行设置

1)进入到该项目到目录下

$ cd Matchismo


2)找到xcuserstate,并设置到忽略文件夹中

find .   找到隐藏文件xcuserstate,用来记录UI的情况,可以不使用git来提交


.
./.DS_Store
./Matchismo
./Matchismo/.DS_Store
./Matchismo/Base.lproj
./Matchismo/Base.lproj/Main.storyboard
./Matchismo/Card.h
./Matchismo/Card.m
./Matchismo/CardGameAppDelegate.h
./Matchismo/CardGameAppDelegate.m
./Matchismo/CardGameViewController.h
./Matchismo/CardGameViewController.m
./Matchismo/Deck.h
./Matchismo/Deck.m
./Matchismo/en.lproj
./Matchismo/en.lproj/InfoPlist.strings
./Matchismo/Images.xcassets
./Matchismo/Images.xcassets/AppIcon.appiconset
./Matchismo/Images.xcassets/AppIcon.appiconset/Contents.json
./Matchismo/Images.xcassets/cardBack.imageset
./Matchismo/Images.xcassets/cardBack.imageset/cardBack-1.png
./Matchismo/Images.xcassets/cardBack.imageset/cardBack.png
./Matchismo/Images.xcassets/cardBack.imageset/Contents.json
./Matchismo/Images.xcassets/cardFront.imageset
./Matchismo/Images.xcassets/cardFront.imageset/cardFront-1.png
./Matchismo/Images.xcassets/cardFront.imageset/cardFront.png
./Matchismo/Images.xcassets/cardFront.imageset/Contents.json
./Matchismo/Images.xcassets/Image.imageset
./Matchismo/Images.xcassets/Image.imageset/Contents.json
./Matchismo/Images.xcassets/LaunchImage.launchimage
./Matchismo/Images.xcassets/LaunchImage.launchimage/Contents.json
./Matchismo/main.m
./Matchismo/Matchismo-Info.plist
./Matchismo/Matchismo-Prefix.pch
./Matchismo/model
./Matchismo/model/CardMatchingGame.h
./Matchismo/model/CardMatchingGame.m
./Matchismo/PlayingCard.h
./Matchismo/PlayingCard.m
./Matchismo/PlayingCardDeck.h
./Matchismo/PlayingCardDeck.m
./Matchismo.xcodeproj
./Matchismo.xcodeproj/project.pbxproj
./Matchismo.xcodeproj/project.xcworkspace
./Matchismo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
./Matchismo.xcodeproj/project.xcworkspace/xcuserdata
./Matchismo.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad
./Matchismo.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate
./Matchismo.xcodeproj/xcuserdata
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/Matchismo.xcscheme
./Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist
./MatchismoTests
./MatchismoTests/en.lproj
./MatchismoTests/en.lproj/InfoPlist.strings
./MatchismoTests/MatchismoTests-Info.plist
./MatchismoTests/MatchismoTests.m


3)将文件导入到gitignore


bogon:Matchismo chris$ echo Matchismo.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate >.gitignore   


bogon:Matchismo chris$ cat .gitignore
Matchismo.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate

4)在项目文件目录下 执行指令:git init

bogon:Matchismo chris$ git init
Initialized empty Git repository in /Users/chris/developer/Matchismo/.git/

5)当前目录添加到git
bogon:Matchismo chris$ git add . 

bogon:Matchismo chris$ git commit -m "Now under sorce control”  第一次提交的注释
[master (root-commit) 3eb6864] Now under sorce control
 37 files changed, 1643 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Matchismo.xcodeproj/project.pbxproj
 create mode 100644 Matchismo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
 create mode 100644 Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
 create mode 100644 Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/Matchismo.xcscheme
 create mode 100644 Matchismo.xcodeproj/xcuserdata/chris.xcuserdatad/xcschemes/xcschememanagement.plist
 create mode 100644 Matchismo/Base.lproj/Main.storyboard
 create mode 100644 Matchismo/Card.h
 create mode 100644 Matchismo/Card.m
 create mode 100644 Matchismo/CardGameAppDelegate.h
 create mode 100644 Matchismo/CardGameAppDelegate.m
 create mode 100644 Matchismo/CardGameViewController.h
 create mode 100644 Matchismo/CardGameViewController.m
 create mode 100644 Matchismo/Deck.h
 create mode 100644 Matchismo/Deck.m
 create mode 100644 Matchismo/Images.xcassets/AppIcon.appiconset/Contents.json
 create mode 100644 Matchismo/Images.xcassets/Image.imageset/Contents.json
 create mode 100644 Matchismo/Images.xcassets/LaunchImage.launchimage/Contents.json
 create mode 100644 Matchismo/Images.xcassets/cardBack.imageset/Contents.json
 create mode 100644 Matchismo/Images.xcassets/cardBack.imageset/cardBack-1.png
 create mode 100644 Matchismo/Images.xcassets/cardBack.imageset/cardBack.png
 create mode 100644 Matchismo/Images.xcassets/cardFront.imageset/Contents.json
 create mode 100644 Matchismo/Images.xcassets/cardFront.imageset/cardFront-1.png
 create mode 100644 Matchismo/Images.xcassets/cardFront.imageset/cardFront.png
 create mode 100644 Matchismo/Matchismo-Info.plist
 create mode 100644 Matchismo/Matchismo-Prefix.pch
 create mode 100644 Matchismo/PlayingCard.h
 create mode 100644 Matchismo/PlayingCard.m
 create mode 100644 Matchismo/PlayingCardDeck.h
 create mode 100644 Matchismo/PlayingCardDeck.m
 create mode 100644 Matchismo/en.lproj/InfoPlist.strings
 create mode 100644 Matchismo/main.m
 create mode 100644 Matchismo/model/CardMatchingGame.h
 create mode 100644 Matchismo/model/CardMatchingGame.m
 create mode 100644 MatchismoTests/MatchismoTests-Info.plist
 create mode 100644 MatchismoTests/MatchismoTests.m
 create mode 100644 MatchismoTests/en.lproj/InfoPlist.strings
bogon:Matchismo chris$ 
0 0
原创粉丝点击