Git は単に時系列順にバージョンを管理するだけでなく、別々の時間軸のバージョンを管理できる。 さらにそれらを統合することができる。 別々の時間軸のことを branch と呼び、それらを統合することを merge と言う。 この merge ができるので、branchを分けて独立に進めることができる。 26 shumon.fujita 元バージョン A A’ 元バージョンに A A’ B B’ を足したもの B B’
2ff810a 2st commit 2 pick 80e4e22 3rd commit 3 pick 6bb05cb 4th commit 4 5 # Rebase 17c2008..6bb05cb onto 17c2008 (3 commands) 6 # 7 # Commands: 8 # p, pick <commit> = use commit 9 # r, reword <commit> = use commit, but edit the commit message 10 # e, edit <commit> = use commit, but stop for amending 11 # s, squash <commit> = use commit, but meld into previous commit 12 # f, fixup <commit> = like "squash", but discard this commit's log message 13 # x, exec <command> = run command (the rest of the line) using shell 14 # b, break = stop here (continue rebase later with 'git rebase --continue') 15 # d, drop <commit> = remove commit 16 # l, label <label> = label current HEAD with a name 17 # t, reset <label> = reset HEAD to a label ・・・
2ff810a 2st commit 2 pick 80e4e22 3rd commit 3 pick 6bb05cb 4th commit 4 5 # Rebase 17c2008..6bb05cb onto 17c2008 (3 commands) 6 # 7 # Commands: 8 # p, pick <commit> = use commit 9 # r, reword <commit> = use commit, but edit the commit message 10 # e, edit <commit> = use commit, but stop for amending 11 # s, squash <commit> = use commit, but meld into previous commit 12 # f, fixup <commit> = like "squash", but discard this commit's log message 13 # x, exec <command> = run command (the rest of the line) using shell 14 # b, break = stop here (continue rebase later with 'git rebase --continue') 15 # d, drop <commit> = remove commit 16 # l, label <label> = label current HEAD with a name 17 # t, reset <label> = reset HEAD to a label ・・・ ここ目的のコマンドに変 更する
Git の基礎 114 $ git submodule add https://github.com/chaconinc/DbConnector $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: .gitmodules new file: DbConnector $ git submodule status # submoduleのどのコミットハッシュを参照しているか確認できる
Git の基礎 115 $ git submodule add https://github.com/chaconinc/DbConnector $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: .gitmodules new file: DbConnector $ git submodule status # submoduleのどのコミットハッシュを参照しているか確認できる 個人的にはパッケージングできるならその 方が好み
tree オブジェクト に書き換えられ、それ以外はコピーされる。 tree オブジェクトを作ったら、次は後述する commit オブジェクトを作る。 commit オブジェクトは、リポジトリのルートにあたる tree オブジェクトを参照していて、commit 時のリポジトリの 状態を再現できるようになっている。 コミットの仕組み https://git-scm.com/book/en/v2/Git-Internals-Git-Objects