LoginSignup
1
0

More than 1 year has passed since last update.

GItの取説(備忘録)

Posted at

はじめに

gitの扱いに苦労した経験があるので、自身がまとめたgitの取説を今回は書いていきます!

gitの流れ

①cd ファイル名 カレントディレクトリに移動
②git init ローカルリポジトリ新規作成
③git add ファイル名 ファイル追加(git add . で一括追加)  
④git commit -m "コミットメッセージ" ローカルにコミットし、メッセージを書く
⑤git remote add orign リモートリポジトリURL リモートリポジトリに移す準備
⑥git push origin main (git push -u origin mainで次回からgit pushでOKです。)プッシュする

これで、githubに無事コードを保管できます。

その他のgitのコマンド説明

確認、変更系
git branch ブランチの確認
git log コミット履歴を確認
git status ファイルの追加/変更/削除部分の確認
git branch -M main ブランチ変更

チーム開発の時に使ったコマンド

ブランチの作成、移動
git checkout -b ブランチ名 作成と移動両方できる
git branch ブランチ名 ブランチ作成
git checkout ブランチ名 ブランチ移動

自分のブランチに反映させる
①git checkout develop developに移動
②git pull origin develop プルする
③git checkout 自分の作業ブランチ 作業ブランチに移動
④git merge origin/develop 自分のブランチに反映

実際の開発フロー
①git checkout develop 統合ブランチに移動
②git checkout -b (トピックブランチ) ブランチ作成
~作業が完了したら~
③git add -A 全てaddする
④git commit -m "コミットメッセージ" ローカルコミットする
⑤git push origin (自分の作業ブランチ) リモートにプッシュする

さいごに

今回は自身がgitで必須で使っていたコマンドを紹介しました。
役に立つと幸いです!ありがとうございました!

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