0
1

More than 3 years have passed since last update.

自分用gitコマンドメモ

Last updated at Posted at 2020-05-12

自分用です。

設定関係

設定には3つあり、system,global,localの順に読み込まれる

  • system
    • システム全体の設定
  • global
    • 概要ユーザーの全リポジトリ
  • local
    • 該当リポジトリ

現在有効な設定の確認

git config -l

個別に設定を確認

git config --local -l
git config --global -l
git config --system -l

設定の編集

git config user.name example
git config user.email example@example.com

GitHub

githubへつなぐ手順はgitでrepositoryを作成すると出てくるので省略。
ファーストコミットが終了した後の処理

GitHubに変更を上げる

git pull origin master
git push origin master

pullでマージしてから、pushで上げる

ローカルの変更取り消し

git checkout .

前回のコミットからファイルの変更をリセットしてくれる。
新規追加したファイルは削除されない。
完全に元に戻したいのであれば別途消去コマンドを打つ。

git clean -df .

※オプションの意味
 -d: ディレクトリを削除対象に含める。
 -f(--force): ファイル削除を強制的に実行する。

ステージへのaddの取り消し

ステージにaddした変更もリセットする場合は下記。

git reset HEAD .

Screen Shot 2020-05-12 at 17.58.53.png
※図解gitより

参考

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