1
2

More than 1 year has passed since last update.

GitHubでの作業の流れと使うコマンド

Last updated at Posted at 2022-06-12

①リモートから情報取得

ゼロからの場合(ローカルはまっさらな状態)

git clone <remote_repo_URI>

ローカルもリモートもまっさらな場合

  1. GitHubでリモートリポジトリ作成
  2. ローカルの作業ディレクトリでgit init (add&commit...)
  3. git remote add <remote_name> <remote_repo_URI>
  4. git branch -M main
  5. git push -u origin main(ユーザーネームとパスワードを聞かれる。GitHubマイページ>Settingsでトークン発行)

既に以前のリモートの状態がローカルにある場合

  1. git fetch <リモート名> <ブランチ名>
  2. git merge <リモート追跡ブランチ名>

②ローカルで作業〜プルリクまで

  1. git checkout -b <ブランチ名> (ブランチ名はfeature/developなど)
  2. 作業進めて git add
  3. git commit
  4. git push <リモート名> <ブランチ名>
  5. GitHubページ上でプルリクエスト作成

③プルリクマージ後

  1. GitHubページ上でリモートブランチ削除
  2. git pull
  3. git fetch --prune(リモート追跡ブランチ削除)
  4. git branch -d <ブランチ名>(ローカルブランチ削除)

参考

1
2
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
2