LoginSignup
0
0

【git】【コマンド】gitの基本操作コマンドをまとめる

Last updated at Posted at 2024-01-24

Git Config: ログイン情報の設定

  • メールアドレスを設定: git config --global user.email "you@email.com"
  • ユーザー名を設定: git config --global user.name "your name"

ブランチの確認

  • 現在のブランチを確認: git branch
  • ローカルとリモートの全ブランチを確認: git branch -a

Commit後のステータス確認

  • 作業状態を確認: git status
  • 最新のコミットを取り消す: git reset --hard HEAD^

ブランチ操作

  • ブランチ削除: git branch -d <branch-name>
  • 新規ブランチ作成: git checkout -b <new-branch>
  • ブランチの変更を強制プッシュ: git push -f --set-upstream origin <branch-name>
  • ログの確認: git log --oneline

マージ

  • 関連しない履歴を持つブランチをマージ: git merge --allow-unrelated-histories <branch-name>

ステージング操作

  • 特定のファイルをステージングに追加: git add <file-name>
  • すべての変更をステージングに追加: git add -A

変更の確認

  • ステージング前後の差分を確認: git diff

ステージングから削除

  • ファイルをステージングから削除: git rm <file-name>

ステータス確認

  • 作業状態を確認: git status

コミット

  • 変更をコミット: git commit

Vimエディタの操作

  • Vimエディタを終了: :q

Vimエディタでのコミット

  • Vimエディタでコミットメッセージを書いて終了: :wq
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