LoginSignup
1
1

More than 3 years have passed since last update.

【メモ】【自分用】Gitコマンド

Last updated at Posted at 2021-01-10

よく使うGitコマンドのメモ書き

git clone

リモートリポジトリからローカルにcloneする

git clone "https://github.com/XXXX/XXXX"

git status

・赤文字:ローカルの作業ファイルと、ステージングエリアの変更有
・緑文字:ステージングエリアとローカルリポジトリの変更有

git clone "https://github.com/XXXX/XXXX"

git add

変更を加えた作業フォルダを全てステージングエリアに追加

git add .

変更を加えた作業フォルダを指定してステージングエリアに追加

git add "作業ファイル名"

git commit

ステージングエリアからローカルリポジトリにコミット

git commit -v

コミット時補足
'i'   : 入力モード切替
'esc' : コマンドモード切替
':wq' : 保存して終了
':q!' : 保存せず終了

git push

ローカルリポジトリからリモートリポジトリへの反映

git push origin 'ブランチ名'

追記

git rm

ステージングエリアのファイル削除

git revert HEAD

git restore

add前の変更を削除

git restore 'ファイル名'

git branch

現在のブランチの確認

git branch

git revert

直前のコミット取消

git revert HEAD

git log

コミットログの表示
--oneline :コミットログを1行で表示

git log 
git log --oneline 
1
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
1
1