如图所示:在创建 Xcode 工程时,会自动勾选“在 Mac创建 Git 资源”
我们可以发现,工程文件下有个 .git 文件夹,即为我们的 Git 资源文件。
输入 SSH 链接。
查看 SSH 链接如下
iOS 开发,新电脑,新环境。用Xcode,git,但是不喜欢Xcode自带的source tree,又但是每次git pull 、p.sh相关 *** 作都得把项目文件拖进终端,这样就麻烦了很多。
所以记录了Xcode迅速打开终端(Terminal)
1.新建个.sh文件 ,执行一下脚本
#!/bin/sh
if [ -n "$XcodeProjectPath" ]then
open -a Terminal "$XcodeProjectPath"/..
else
open -a Terminal "$XcodeWorkspacePath"/..
fi
2.打开 Xcode 的 Behavior 界面, 如下所示:
然后点击如上图的加号, 出现新建的 Behavior:
选择你刚刚新建的.sh文件,如果文件是灰色的,不可选择点击,打开终端,执行chmod 777 你的.sh文件
chmod +x your_script_name.sh 这玩意好像不起作用,大家注意下
然后添加 勾选run,前面设置个快捷键 command+T,就完成了
1、安装git,官网有安装教程;2、在新建项目到时候会有如下选项
如果创建项目到时候,没有选择创建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条)