git入門

もはやsvnじゃなくてgitな時代であることをひしひし感じたので、使い方を学び始める。

svnとgitの違い

http://www.tempus.org/n-miyo/git-course-trans-ja/svn.ja.html

リポジトリ


gitはベアリポジトリ(bare)と呼ばれる、ワーキングコピーにくっついていないリポジトリを作ることもできる。git cloneとsvn checkoutは似てるが、git cloneはリポジトリを文字通り複製で、svn checkoutはリポジトリからワーキングコピーをつくるのである。

URL


gitのリポジトリには常にブランチとタグが含まれ、ブランチの1つがデフォルトになる(通常masterと名づけられる)

コマンド

svnから移行時に理解が難しかったもの。

git remote: リモートリポジトリを扱う

Manage the set of repositories ("remotes") whose branches you track.

git branch: ブランチのリスト/追加/削除

With no arguments, existing branches are listed and the current branch will be highlighted with an asterisk. Option -r causes the remote-tracking branches to be listed, and option -a shows both.

git checkout: ブランチの切替

Checkout a branch or paths to the working tree

svnのcheckoutとworking copyをつくるという意味では同じだけど、ローカルにリポジトリはあるので、実質ブランチの切替だと思うと理解しやすいか。

git push: リモートリポジトリにcommitを反映
git push *** xxxx

若干正確じゃないかもしれないけど、***というリモートリポジトリにxxxというローカルのブランチをpushというイメージ。