しゅがーブログ

技術ネタとか書いていけたらな…

gitコマンドメモ

よく使用するgitコマンドについてまとめていきます。

定期的に更新してく予定です。

  • 初期設定
git config --global user.name "hogehoge"
git config --global user.email hogehoge@hoge.com
  • レポジトリ作成
git init
git add -A
git commit -m "Initialize repository"
  • ステータス
git status
  • コミット
git add -A
git commit -m "Update repository"
  • リモートレポジトリ(GitHubの場合)
git remote add origin git@github.com:<ユーザ名>/<レポジトリ名>.git
git push -u origin --all
  • ブランチ
git checkout -b hogehoge
  • マージ
git checkout master
git merge hogehoge
  • 強制プッシュ
git push -f