簡體   English   中英

無法使用gitk -all或git log --graph查看git分支結構

[英]Unable to see git branch structure using gitk -all or git log --graph

我正在使用本教程學習git版本控制:

http://net.tutsplus.com/tutorials/other/easy-version-control-with-git/

現在我進行了2-3次提交,然后進行了切換,切換到另一個分支。 然后我又做了2-3次提交。

但是我仍然在gitk -allgit 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

沒有什么不對。 您有一條直線提交線:

A-->B-->C-->D-->E-->F
        ^           ^
   BranchA        BranchB

如果現在簽出BranchA並進行一些提交,您將在gitk --all看到分支分歧

這是因為您的提交歷史記錄可以直線顯示。

* 5 (HEAD, my-branch)
* 4
* 3 (master)
* 2
* 1

如果您掌握一些東西會變得很有趣

* 6 (HEAD, master)
| * 5 (my-branch)
| * 4
|/
* 3
* 2
* 1

不能再以直線顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM