git 使い方メモ

発端

Wolfgang閣下から「***NOTE*** for patch submission」というmailがMLに流れてきた。

曰く:

When you submit patches, please check carefully:

* patches that are only bug fixes (i. e. they don't introduce new
features or significant amount of new code) must be submitted
against current mainline, i. e. the "master" branch

* all NEW stuff should be submitted against the "next" branch.

ということでcommunityにfeedbackする場合は
"next" branch に対するpatchを送らねばならぬ模様。

分散レポジトリとか覚えるの面倒・・・と、
先送りにしていたがそろそろ単純な作業は出来るようにしておいた方がよさそう。

色々とGITに移行したOSSも多いようだし。sourceforge.jp でも使えるようになったみたいだし。

とりあえずマスター取得

cloneを作るという概念らしい。

  takino@delphinus-iv:~$ git clone git://git.denx.de/u-boot.git
  Initialized empty Git repository in /home/takino/u-boot/.git/
  remote: Counting objects: 86575, done.
  remote: Compressing objects: 100% (15977/15977), done.
  remote: Total 86575 (delta 71069), reused 85514 (delta 70078)
  Receiving objects: 100% (86575/86575), 28.44 MiB | 73 KiB/s, done.
  Resolving deltas: 100% (71069/71069), done.
  takino@delphinus-iv:~$

ブランチの確認

branchコマンドで確認か?

  takino@delphinus-iv:~$ cd u-boot/
  takino@delphinus-iv:~/u-boot$ git branch 
  * master
  takino@delphinus-iv:~/u-boot$

あれ?cloneだけでは取得できんのか?

clone元のブランチを確認

クローン元はオプション指定しないと見れないらしい。

  takino@delphinus-iv:~/u-boot$ git branch -r
    origin/HEAD
    origin/i.MX31
    origin/lwmon5
    origin/master
    origin/next
    origin/origin
    origin/wd@denx.de
  takino@delphinus-iv:~/u-boot$

orgin/next が件の branch と見た。

さて、このbranchとlocalを同等にするには???

クローン元のブランチと同等のローカルブランチを作成

概念を理解してないのでアレだが、gitではマスターのブランチを直接チェックアウトできない?

マスターのブランチを元に自身のブランチを作成し、そこで作業するらしい。

  takino@delphinus-iv:~/u-boot$ git checkout -b next4me origin/next
  Branch next4me set up to track remote branch refs/remotes/origin/next.
  Switched to a new branch "next4me"
  takino@delphinus-iv:~/u-boot$

これでいいっぽい。

git所感

  • 最初にsubversionを触った時と違ってしっくりこない。なんかAlienっぽい。
    • 最初にcvs触ったときの感覚に近い。
  • 現段階の私には感覚で使えるツールではないな、と。
    • 気をつけて使わないとリモートレポジトリ破壊しそう (ぉぃ