我正在使用本教程学习git版本控制:
http://net.tutsplus.com/tutorials/other/easy-version-control-with-git/
现在我做了2-3次提交,然后制作并切换到另一个分支。然后我又做了2-3次提交。
但我仍然在gitk -all
或git log --graph
中看到一条简单的直线。
可能出现什么问题?
user@comp:~/Documents/trygit2$ git add .
user@comp:~/Documents/trygit2$ git commit -m 'first commit'
[master (root-commit) d525eb9] first commit
0 files changed
create mode 100644 file1
user@comp:~/Documents/trygit2$ git add .
user@comp:~/Documents/trygit2$ git commit -m 'second commit'
[master 5fe0bba] second commit
0 files changed
create mode 100644 file2
user@comp:~/Documents/trygit2$ git branch branch1
user@comp:~/Documents/trygit2$ git checkout branch1
Switched to branch 'branch1'
user@comp:~/Documents/trygit2$ git add .
user@comp:~/Documents/trygit2$ git commit -m 'branch commit1'
[branch1 84e162e] branch commit1
0 files changed
create mode 100644 branchfile
user@comp:~/Documents/trygit2$ git add .
user@comp:~/Documents/trygit2$ git commit -m 'branch commit 2'
[branch1 bb7a619] branch commit 2
0 files changed
create mode 100644 branchfile2
user@comp:~/Documents/trygit2$ git status
# On branch branch1
nothing to commit (working directory clean)
user@comp:~/Documents/trygit2$ git log --graph
* commit bb7a619990925782c37921e80c3aaf8310530de2
| Author: = <=>
| Date: Fri May 17 16:33:58 2013 +0530
|
| branch commit 2
|
* commit 84e162e186dc1a7d51ac48eaf3d05748178da803
| Author: = <=>
| Date: Fri May 17 16:33:42 2013 +0530
|
| branch commit1
|
* commit 5fe0bbaf72b3db9f456c5687efd425b0dac28466
| Author: = <=>
| Date: Fri May 17 16:32:50 2013 +0530
|
| second commit
|
* commit d525eb935deb4899293db64bdbc350add21bc943
Author: = <=>
Date: Fri May 17 16:32:28 2013 +0530
first commit
答案 0 :(得分:4)
没错。你有一个直接的提交行:
A-->B-->C-->D-->E-->F
^ ^
BranchA BranchB
如果您现在结帐BranchA
并进行一些提交,您会看到gitk --all
答案 1 :(得分:1)
这是因为您的提交历史记录可以直线显示。
* 5 (HEAD, my-branch)
* 4
* 3 (master)
* 2
* 1
如果您提交一些东西来掌握
,那就很有趣了* 6 (HEAD, master)
| * 5 (my-branch)
| * 4
|/
* 3
* 2
* 1
这不能再以直线显示。