0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【超基礎】Gitコマンド備忘録

Posted at

はじめに

本記事はGitを学び始めた筆者が、超基本的なGitコマンドをまとめたものです。 文量を抑え、適宜参照しやすくなるよう心掛けました。

また、本記事は備忘録であり、Qiitaへの投稿の練習でもあります。
記事の内容や構成についてご指摘・アドバイスを頂けると、筆者が飛んで喜びます。

環境

- OS : Windows10 - Git : 2.31.0 - 使用ツール : Git Bash

コマンド一覧

| コマンド| 説明 | 使用例 | |:-----------|:------------|:------------| | $git init [directory name]| 指定したデイレクトリをGitの管理下に置く| $git init ./hogehoge | | $git clone [URL]| リモートリポジトリをローカルへ複製する| $git clone git@github~| | $git pull| リモートリポジトリの変更をローカルへ反映する| | | $git push| ローカルの変更をリモートリポジトリへ反映する | | | $git log| 過去のコミットログの参照| | | $git log --graph| コミットログをグラフ形式で描画| | | $git reflog| コミットログの参照| | | $git status| ローカルのステータスを表示| | | $git diff| 最新コミットからの差分を表示| | | $git add [filename] | 指定したファイルorディレクトリをステージング| $git add hogehoge.py | | $git commit -m 'comments' | コメントを付与してコミット| $git commit -m 'First commit.' | | $git commit -am 'comments' | ステージングしつつ、コメントを付与してコミット| $git commit -m 'Fixed hogehoge.py'| | $git commit --amend| 最新コミットのコメントを修正する| | | $git branch| ブランチを一覧で表示| | | $git checkout [branch name]| ブランチの切り替え | $git checkout branch-A | | $git checkout -b [branch name]| 新規ブランチを作成し、そこへ切り替え| $git checkout -b branch-B | | $git merge [branch name]| ブランチのマージ| $git merge branch-C | | $git reset --hard [ハッシュ値]| 指定したコミットまで移動する[^1]| $git reset --hard 1195e31| | $git rebase -i HEAD~[number]| 指定したコミットの範囲を改変する[^2] | $git rebase -i HEAD~2|

参考文献

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?