LoginSignup
2
3

More than 5 years have passed since last update.

gitコマンドメモ

Last updated at Posted at 2017-09-03

使うけど忘れやすいgitコマンドの自分用メモです。

ブランチの一覧を表示(aはリモートブランチも表示する)

git branch -a

ブランチの作成

git branch new_branch

チェックアウト

git checkout new_branch

ブランチの作成とチェックアウトを同時に行う

git checkout -b new_branch

ステージングに追加

git add *

コミット

git commit -m "comment."

リモートブランチへプッシュする

git push origin hoge_branch

変更したファイルを変更前に戻す

git checkout HEAD file_name

打ち消しのコミットを作成する

git revert commit

リベース

リベース開始

git rebase hoge_branch

コンフリクトを解消してリベースを継続する

git rebase --continue

リベースを終了する(リベース前の状態に戻す)

git rebase --abort

stash

現在の変更を保存する

git stash save
git stash save "comment."

保存している変更のリストを表示

git stash list

現在のブランチに変更を適用する

git stash pop stash@{N}

bashのエイリアスについて

~/.bash_profileに以下を追加して source ~/.bash_profile を実行する。

alias gs='date && git status'
alias gp='date && git pull'

2
3
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
2
3