2014年4月1日火曜日

[git] git 基本

最近svnの変わりにgitを使うようになったのでそのメモ

git status 
git branch -a -v : local branchやremote branch、最終コミットログが見れる
git checkout -b local_branch origin remote_name : remote_branchからlocal branchを作る
git checkout localfile : localbranch からlocalfileを復元する。 
git add localfile : 指定したファイルをstage状態にする(commit出来る状態にする)
git commit : stage状態にあるファイルをローカルブランチにcommitする(この状態ではremote branchにはcommitされない)
git push origin local branch:origin/remote branch : remote branchにcommitする。これをやると後戻りできない。
基本的な概念がsvnと違うので結構戸惑った。っていうか今も。