MacでGitを使う

インストール

GUIも使いたいのでMacPortsでGitXをインストール(gitも一緒に入る)

$ sudo port install GitX

初期設定

自分の名前とE-mailを設定

$ git config --global user.name "名前"
$ git config --global user.email "メール"

カラー出力

$ git config --global color.ui auto

リポジトリ作成

ローカルのリポジトリを作って初期化(例ではxxrepoがレポジトリ名)

$ mkdir xxrepo
$ cd xxrepo
$ git init

ファイル登録

リポジトリにファイルを登録

$ git add xx.rb
$ git commit -m "first commit"

変更点を確認

ファイルの変更点を確認

$ git diff

ファイルの変更を記録

変更したファイルの状態を記録

$ git add xx.rb

コミット

変更内容をコミット

$ git commit -m "fixed bug"