夜の Discovery このページをアンテナに追加 RSSフィード

セイバーメトリクス対応!野球の成績・チーム・試合管理の決定版!『ガチャスポ ベースボール』

2008-07-15

Windows から Git を使う方法

railssvn から git に移行したし、そろそろ git を使う必要があると観念して調べてみました。

Windows から git を使う公式な方法は cygwin しかないみたい*1ですが、

非公式な方法として msysgit というアプリケーションを使う方法があります。


msysgit - Google Code

http://code.google.com/p/msysgit/


今回は Git-1.5.6.1-preview20080701.exe をダウンロードしてインストールしました。

インストール

Adjusting your PATH environment

コマンドプロンプトから使用したいので、「Run Git from the Windows Command Prompt」を選択。

Choosing the SSH executable

使うとすれば putty を使うので「Use PLink」を選択。


インストール完了したら、コマンドプロンプトを立ち上げて、gitインストールされたことを確認します。

C:\>git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tre
e=GIT_WORK_TREE] [--help] COMMAND [ARGS]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find the change that introduced a bug by binary search
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific command.

使い方は、例えば jpmobile ならこんな感じ。

# チェックアウト
git clone git://github.com/darashi/jpmobile.git
# プラグインインストール
ruby script/plugin install git://github.com/darashi/jpmobile.git

ちなみに rails2.0.2 では git からのプラグインインストールはできませんでしたが、2.1.0 で試すとうまく動きました。