Gitコマンドいろいろ
http://sourceforge.jp/magazine/09/03/16/0831212
git branch
現在のブランチを表示
新規branch作成
git branch name
branch切替
git checkout name
branch削除
git branch -d
\-D
リモートブランチを削除
git push origin :branchname
branch名変更
git branch -m name newname
リモートブランチをコピー
git branch -r
git fetch --prune
git branch new_branch_name origin/new_branch_name
git checkout new_branch_name
git pull origin new_branch_name
marge
マスターにマージ。
git checkout master
git merge branchname
git add
ステージングにファイルを追加する。
ファイル指定
git add file file
管理下のファイル全て
git add .
変更が加えられたファイルと、未追跡だったファイル
git add --all
add 取り消し
git reset HEAD file
修正を戻す
git reset --hard
git commit
コミット。ステージングファイル全て
ファイル指定
git commit file file
diff
二つのコミットの差分を表示する
git diff commit1 commit2
clone
リモートリポジトリをローカルへコピー
git clone path app_dir
リモートから特定のブランチを指定してcloneする方法
git clone -b ブランチ名 https://リポジトリのアドレス
tag
タグを指定してclone
git clone --depth=1 -b v2.0494 https://github.com/path.git
git push
リモートリポジトリへ反映
git push origin master
ブランチを指定
git push origin ローカルブランチ:リモートブランチ
強制上書き
\-f
ブランチ削除
git push origin :branch-name
git stash
http://qiita.com/fukajun/items/41288806e4733cb9c342
作業ファイルの退避
git stash
git stash list
git stash apply stash@{0}
git stash drop stash@{0}
差分確認
git diff stash@{0}
git diff stash@{0} hoge.txt
git remote
リモートリポジトリを登録
git remote add
設定削除
git remote rm origin
git checkout
作業ディレクトリの状態を戻す
git checkout .
git checkout file
ファイルの削除は行われない。
git config
リポジトリの設定表示
git config -l
ユーザー情報設定
git config --global user.name name
git config --global user.email email
pullに失敗した時
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
fetchしreset
$ git fetch origin $ git reset --hard FETCH_HEAD
特定のファイルの変更を無視する
git update-index --assume-unchanged [path]
解除
git update-index --no-assume-unchanged [path]
管理下から除外
git rm --cached [ファイル名]
git add -u