LoginSignup
1
1

Githubとxcodeプロジェクトファイルの紐付け

Last updated at Posted at 2023-01-23

Githubとxcodeプロジェクトファイルの紐付け

まず、 githubにリポジトリを作成してください。

つぎに、 xcodeにプロジェクトを作成します。
(iosを選択すると、Storyboardを選択できるよ)
2023-01-23 18.53のイメージ.jpg

プロジェクト名を保存して、ファイルを作成してください。

ターミナルで xcodeのプロジェクトファイル に移動する。
$ cd プロジェクト名

githubとターミナルを紐付ける。
$ git config --global user.name "Gitのユーザー名"

$ git config --global user.email "メールアドレス"

【githubにアップしたくないものを入れておくファイルの作成】

touchコマンドで作成
$ touch .gitignore

gitignoreを開くコマンド
$ open .gitignore

参考
https://github.com/github/gitignore/blob/main/Swift.gitignore
https://www-creators.com/archives/1662
https://ios-docs.dev/xcode-gitignore/

〜ローカルリポジトリでの作業〜

ターミナルで以下のコマンドを実行
$ git init

変更されたファイルをステージングエリア(ステージ、インデックスとも呼ばれます)に追加する
$ git add ファイル名
もしくは全部のファイルをステージングさせる
$ git add .

登録されている状態を確認するコマンド
git status

コミットメッセージを記入
$ git commit -m "first commit"

コミットされたことを確認する
$ git log

〜リモートリポジトリに更新〜

$ git remote add origin “リポジトリのURL”

リモートリポジトリにプッシュ
$ git push -u origin main
(今まで”master”でしたが、最近”main”に変わりました。)

【おまけ】

現在いるブランチの確認
$ git branch

新しいブランチを作る
$ git branch ブランチ名

別のブランチに移動する
$ git checkout ブランチ名

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1