LoginSignup
1
0

More than 3 years have passed since last update.

gitの基本コマンドをおさらいする

Posted at

リポジトリを作ったところからマージまで。

gitリポジトリの取得(パターンA)

git clone <ssh://~~~.git>

リモートリポジトリの確認

git remote -v

ブランチ一覧の確認

git branch -a

ブランチの作成

git checkout -b <branch_name>

ブランチをリモートに登録

git push -u origin <branch_name>

ブランチの切り替え

git checkout <master>

変更したものを確認(ファイル)

git status

変更したものを全部戻す

git checkout .

前回のコミットとの差分を確認(内容)

git diff

ファイルをインデックスにまとめて追加

git add .

addの取り消し

git reset HEAD

addしたものをローカルリポジトリに追加

git commit -m '<first commit>'

1つ前のcommitの取り消し

git reset --soft HEAD^

リモートリポジトリへpush

git push

マージ

git merge <dev>
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