GIT 中这个图究竟代表什么?

What exactly represent this graph in GIT?

我绝对是 GIT 的新手,我在理解如何阅读我正在处理的项目的图表时遇到了一些问题。

所以我做了下面的操作

1) 我在我的项目上创建了一个名为 easy-mode 的新本地分支,这样:

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git branch easy-mode

2) 然后我通过以下方式查看项目的所有分支(本地和远程):

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git branch -a
  easy-mode
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/coins
  remotes/origin/master

所以我有活跃的本地分支 mastereasy-mode 空分支和 3 个 remote分支.

3) 我从 master 分支切换到 easy-mode 分支,这样每个新提交都将在 easy-mode 分支而不在 master 上,作者:

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git checkout easy-mode
Switched to branch 'easy-mode'

事实上现在已经切换了:

$ git branch
* easy-mode
  master

4) 我将名为 game.js 的文件修改到我的项目中,然后添加并提交它,这样它将被提交到 easy-模式分支。

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git add game.js

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git commit
[easy-mode e06528a] feature: easy mode: the asteroids will be splitted in 2 inst
ead 3.
 1 file changed, 2 insertions(+)

5) 现在我通过 git log --graph --oneline --decorate=full --all:

打印图表
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git log --graph --oneline --decorate=full --all
* e06528a (HEAD -> refs/heads/easy-mode) feature: easy mode: the asteroids will
be splitted in 2 instead 3.
* cba1887 (refs/heads/master) fixing: fixed the bug related of the weapon delay
* 3884eab (refs/remotes/origin/master, refs/remotes/origin/HEAD) Add color
* 3e42136 now using requestAnimationFrame
* 4035769 frame interval was set wrong after game was paused
* 25ede83 a couple missing ends with the ipad version
* df03538 I can't spell 'screen' apparently :)
| * 354dfdd (refs/remotes/origin/coins) Make ships able to spawn on coins
| * 0c6daf1 Make it possible to collect coins
| * a3c0ae4 Create helper functions
| * 656b02e First pass at adding coins
|/
* b0678b1 Revert controls

................................................................
................................................................
................................................................

我在理解如何阅读上一张图时遇到了一些问题。

为什么远程分支 refs/remotes/origin/coins 由类似 "subtree" 的东西标识,以 |/[=64= 开头] 个字符:

| * 354dfdd (refs/remotes/origin/coins) Make ships able to spawn on coins
| * 0c6daf1 Make it possible to collect coins
| * a3c0ae4 Create helper functions
| * 656b02e First pass at adding coins
|/

refs/heads/easy-mode 分支似乎更像是图中的一个节点而不是子树?

另一个疑问与这个 easy-node 分支被 (HEAD -> refs/heads/easy-mode).为什么是 HEAD?在我看来,这个分支是项目的负责人(包含最后一次提交或类似的东西)但是分支不应该作为树中新的分离分支?

我的考虑有什么问题吗?我错过了什么?

git 日志显示格式化为时间而非分支结构的提交。

如果你给 git 日志涂上颜色,那么你可能会看到 master 并不总是最左边的分支。

git log log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all

来自 Pretty git branch graphs


来自 Viewing full version tree in git