我在GIT中是全新的,我有一些问题要理解如何读取我正在处理的项目的图表。
所以我做了下面的操作。
1)我在我的项目中创建了一个名为轻松模式的新本地分支,其方式如下:
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git branch easy-mode2)然后,我通过以下方式看到了我的项目(本地项目和远程项目)的所有进展:
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因此,我有活动的本地分支,即主分支、轻松模式的空分支和3远程分支。
3)我从主分支切换到轻松模式的分支,因此每一个新的提交都将在轻松模式的分支上完成,而不是在主上完成,方法是:
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git checkout easy-mode
Switched to branch 'easy-mode'事实上,现在它被切换了:
$ git branch
* easy-mode
master4)我将一个名为game.js的文件修改到我的项目中,并将其添加并提交到轻松模式分支中。
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日志打印图表--图--单线--装饰=完全--全
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由一个“子树”来标识,该“子树”以\/字符开头:
| * 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分支看起来更像是图中的一个节点,而不是子树?
另一个疑问与以下事实有关:这个易节点分支由(HEAD -> related /heads/easy-mode)认证。为什么HEAD?在我看来,这个分支是项目的负责人(包含最后一次提交或类似的内容),但是分支不应该作为树中的一个新的分离分支?
我的考虑有什么不对?我遗漏了什么?
发布于 2016-07-28 14:43:41
git日志显示的提交是按时间格式化的,而不是分支结构。
如果您对git日志进行着色,那么您可能会看到母版并不总是最左边的分支。
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

https://stackoverflow.com/questions/38639137
复制相似问题