我是GIT的新手,我对分支机构有以下疑问。
我使用以下命令创建了一个名为轻松模式的新分支
git branch easy-mode然后我看到我的分支,这是输出:
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git branch
* easy-mode
master因此,这意味着正确创建了轻松模式分支,此时它是活动分支。是真的吗?
好的,然后我修改了一个名为game.js的文件,我将它添加到了暂存区域,最后提交了它。因此,我希望此提交与轻松模式的分支(也就是活动分支)相关。
现在的问题是,为了显示提交图,我获得了以下结果:
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git log --graph master easy-mode
* commit 59b4bce5964825b7c6fec4270ba34d2166f5168e
| Author: Andrea Nobili <nobili.andrea@gmail.com>
| Date: Thu Jul 28 13:17:01 2016 +0200
|
| Make asteroids split into 2 smaller pieces instead of 3
|
* commit cba1887f66a579e81c70a607d8402e84fa6e966d
| Author: Andrea Nobili <nobili.andrea@gmail.com>
| Date: Thu Jul 28 12:30:06 2016 +0200
|
| fixing: fixed the bug related of the weapon delay
|
* commit 3884eab839af1e82c44267484cf2945a766081f3
| Author: cbuckey <caroline@udacity.com>
| Date: Fri Apr 29 12:33:05 2011 -0700
|
| Add color
|
* commit 3e42136a76cf78c6c421cd720427bf6337c2d623
| Author: Doug McInnes <doug@dougmcinnes.com>
| Date: Tue Mar 15 22:34:49 2011 -0700
|
| now using requestAnimationFrame
|
| see this for more info:
| http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
* commit 4035769377cce96a88d5c1167079e12f30492391
| Author: Doug McInnes <doug@dougmcinnes.com>
| Date: Wed Jun 9 21:04:32 2010 -0700
:所以我正在执行以下命令:
git log --graph master easy-mode我希望看到59b4bce5964825b7c6fec4270ba34d2166f5168e)主分支被分支到包含最后提交的轻松模式分支中(提交到轻松模式分支中)。
但在我看来,我似乎没有简单模式的分支,而且所有提交都在同一条线上。
为什么?怎么啦?我遗漏了什么?
编辑1:
这是git日志的输出--图--单线--装饰--所有的命令:
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (easy-mod
e)
$ git log --graph --oneline --decorate --all
* 67e5e37 (HEAD -> easy-mode) feature: easy mode, the asteroids are split in 2 instead of 3
* cba1887 (master) fixing: fixed the bug related of the weapon delay
* 3884eab (origin/master, 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 (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
* f19cb1b Fix typo in space
* 75928a9 Use space for movement and enter for shooting
* ac83b72 mostly finished ipad version正如您所看到的,最后一次提交是:
* 67e5e37 (HEAD -> easy-mode) feature: easy mode, the asteroids are split in 2 instead of 3我不明白它是进入新的轻松模式的分支,还是进入主分支,因为在打印的图表中,我无法看到识别新分支到图形中的新分支(如硬币分支在前面的输出中显示的那样)。
为什么?我遗漏了什么?
发布于 2016-07-28 12:06:55
为了在一个命令中创建和签出新分支
git checkout -b easy-mode查看所有分支的最常见命令--只使用一行提交消息--标记整齐。
git log --graph --oneline --decorate --all我通常为这些长的公共命令分配别名。
git config --global alias.la 'log --graph --oneline --decorate --all'现在,您可以简单地使用
git la发布于 2016-07-28 18:14:39
轻松模式分支显示为主模式分支的延续,因为自创建easy-mode以来,没有向主提交任何内容:
master master
| |
v is topologically v
A--B--C equivalent to A--B--C--D
\ ^
D |
^ easy-mode
|
easy-mode创建存储库的实验性克隆,并将其提交到主中。然后,您的历史记录将不再是线性的,轻松模式将显式地与母版区别开来。
master
|
v
A--B--C--E
\
D
^
|
easy-modehttps://stackoverflow.com/questions/38635334
复制相似问题