実用Git
- 作者: Jon Loeliger,吉藤英明(監訳),本間雅洋,渡邉健太郎,浜本階生
- 出版社/メーカー: オライリージャパン
- 発売日: 2010/02/19
- メディア: 大型本
- 購入: 7人 クリック: 287回
- この商品を含むブログ (44件) を見る
今日から読んでいます。
例のオライリーの義援金のときに買ったものの1つ。
インストール
ホストOS Windows Vista の VMWareで動くDebianにインストールします。
$ sudo aptitude install git-core
※git というパッケージもありますが、GUN Interactive Tools というまったく別のものだそうです。
バージョン確認
$ git --version git version 1.5.6.5
よく使うコマンドの一覧
$ git usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=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.
すべてのコマンドの一覧
$ git help --all usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS] available git commands in '/usr/bin' ------------------------------------ add checkout diff-files fsck-objects lost-found merge-recursive parse-remote relink shell unpack-file add--interactive checkout-index diff-index gc ls-files merge-resolve patch-id remote shortlog unpack-objects am cherry diff-tree get-tar-commit-id ls-remote merge-stupid peek-remote repack show update-index annotate cherry-pick fast-export grep ls-tree merge-subtree prune repo-config show-branch update-ref apply clean fast-import hash-object mailinfo merge-tree prune-packed request-pull show-index update-server-info archive clone fetch http-fetch mailsplit mergetool pull rerere show-ref upload-archive bisect commit fetch--tool http-push merge mktag push reset stash upload-pack blame commit-tree fetch-pack imap-send merge-base mktree quiltimport rev-list status var branch config filter-branch index-pack merge-file mv read-tree rev-parse stripspace verify-pack bundle count-objects fmt-merge-msg init merge-index name-rev rebase revert submodule verify-tag cat-file daemon for-each-ref init-db merge-octopus pack-objects rebase--interactive rm symbolic-ref web--browse check-attr describe format-patch instaweb merge-one-file pack-redundant receive-pack send-pack tag whatchanged check-ref-format diff fsck log merge-ours pack-refs reflog sh-setup tar-tree write-tree See 'git help COMMAND' for more information on a specific command.
ヘルプ
$ git help subcommand
または、subcommand に help オプションを渡して
$ git subcommand --help
でもOK
オプションのshort形式とlong形式
$ git commit -m "Fixed a typo." $ git commit --message "Fixed a typo."
short形式(-m)はハイフン1つ
long形式(--message)はハイフン2つ
これはGNUのロングオプション拡張と一致している。そうです。
裸のダブルダッシュ(bare double dash)
引数のリストとオプション指定を分けることができます。
$ git diff -w master origin -- tools/Makefile
(裸のダブルダッシュってはじめて聞いた)