2015/12/01(火)gitコマンドメモ

自分用メモ

初期設定

$ git config --global user.name "nabe"
$ git config --global user.email "nabe-g@example.com"
$ git config --global core.editor vi
$ git config --global color.ui true 
$ git config --global core.pager 'less'
$ git config --list
$ git init
$ git clone http://------/

基本コマンド

$ git status
$ git log
$ git log --oneline
$ git log --pretty=oneline
$ git diff
$ git diff --cached
$ git rm
$ git mv

コミット

$ git commit
$ git commit --amend		直前のコミットをやり直し(上書き)
$ git reset  --soft HEAD^	ファイルをそのままでコミットの取り消し

stash

$ git stash
$ git stash pop
$ git stash list
$ git stash drop stash@{N}

ブランチとタグ

$ git branch new-branch
$ git checkout branch-name
$ git merge develop
$ git tag -a v3.00-beta2 -m "Version 3.0x"
$ git push
$ git push --tags
$ git tag -d DeleteTAG
$ git push origin :DeleteTAG

リモート操作

$ git remote -v
$ git remote add [name] [url]
$ git remote add 
$ git remote rename pb paul

その他

$ git add -p			ソース中の変更箇所を指定してadd
$ git diff --staged		ステージの内容表示
$ git show			指定したハッシュの内容表示
$ git checkout -- .		手元の変更取り消し
$ git log --pretty=oneline