14. 実行してみる
yoshi@mb yoshi% git help
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--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 by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
---snip---
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.
20. 今の状態の確認
yoshi@mb Hokkaido% git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# .shipit
# Changes
# MANIFEST.SKIP
# Makefile.PL
# README
# lib/
# t/
# xt/
nothing added to commit but untracked files present (use "git add" to track)
21. ファイルを追加する
yoshi@mb Hokkaido% git add .
yoshi@mb Hokkaido% git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: .gitignore
# new file: .shipit
# new file: Changes
# new file: MANIFEST.SKIP
# new file: Makefile.PL
# new file: README
# new file: lib/Hokkaido.pm
# new file: t/00_compile.t
# new file: xt/01_podspell.t
# new file: xt/02_perlcritic.t
# new file: xt/03_pod.t
# new file: xt/perlcriticrc
#
25. 再度,現在の状態を確認
yoshi@mb Hokkaido% git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: lib/Hokkaido.pm
# modified: t/00_compile.t
#
no changes added to commit (use "git add" and/or "git commit -a")
26. 変更をコミット
yoshi@mb Hokkaido% git add -u
yoshi@mb Hokkaido% git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: lib/Hokkaido.pm
# modified: t/00_compile.t
#
yoshi@mb Hokkaido% git commit -m 'cities, members関数とそのテストの追加'
[master 66dd358] cities, members関数とそのテストの追加
2 files changed, 13 insertions(+), 2 deletions(-)
30. チェックアウト
yoshi@mb Hokkaido% git log --oneline
66dd358 cities, members関数とそのテストの追加
3bec145 初期状態をコミットします
yoshi@mb Hokkaido% git checkout 3bec145
Note: checking out '3bec145'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 3bec145... 初期状態をコミットします
31. ブランチの作成
yoshi@mb Hokkaido% git checkout 3bec145
Note: checking out '3bec145'.
yoshi@mb Hokkaido% git checkout -b b0.01
Switched to a new branch 'b0.01'
yoshi@mb Hokkaido% git status
# On branch b0.01
nothing to commit (working directory clean)
yoshi@mb Hokkaido% git branch
* b0.01
master
32. ブランチの作成とcheckoutを同時に行
う
yoshi@mb Hokkaido% git checkout -b b0.02 0.02
Switched to a new branch 'b0.02'
yoshi@mb Hokkaido% git branch
b0.01
* b0.02
master