LoginSignup
1
2

More than 3 years have passed since last update.

【gitコマンド 】リポジトリのクローンからリモートへのpushまでする

Last updated at Posted at 2019-04-28

リモートのファイルを自分のPCに反映させる

リモートリポジトリをローカルにクローン
git clone https://hogehoge…

リモートにどんなブランチがあるか確かめる
git branch -a

リモートブランチをローカルにもってくる
例: developブランチ
git checkout -b develop remotes/origin/develop

自分が今いるブランチをかくにん
git branch

最新の情報をローカルに反映させる
git pull

ログをかくにん(コミットが最新の情報か?確認しましょう)
git log

新しく自分の作業するブランチを作る(ローカルブランチの作成)
git checkout -b feature/newbranch(任意のブランチ名をつける)

ローカルでの作業 ファイルを追加したり変更したりする

更新したファイルをリモートリポジトリに反映させよう

更新したファイル全てをインデックスに追加する
git add .

個別にファイルをコミットしたいときは
git add ファイルのパス

インデックスに追加されたファイルをかくにん(コミットする予定のファイルを確認)
git status

コミットする
git commit -m ‘任意のコミットメッセージ’

コミットできたかかくにん
git log

※間違えてたらgit commit —amendで修正できるよ

問題なければリモートにプッシュする
git push

新しく作ったブランチの時は以下のコマンド
git push —set-upstream origin feature/newbranch

リモートリポジトリに、変更が反映されているか確認しましょう

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