Reputation: 361
Im new on GIT,
I have using git maybe 1 month ago, I know how to use branch commit etc, but im still not understandh with the Graph.
this my sample
i create file tes.html
git init
git add *
git commit -a -m '1st_commit'
gitk --all
===============create branch=====
git branch cabang1
git checkout cabang1
/*I modify code on cabang1*/
git commit -a -m cabang1
======create branch2======
git branch cabang2
git checkout cabang2
/*I modify code on cabang2*/
git commit -a -m cabang2
gitk --all
is nothing problem, but why my graph is like this picture
why the grap not create branch like this
commit_cabang1 commit_cabang2
| |
*--------*--------*
master cabang1 cabang2
Can anyone here give me answer why my graph like that?
thanks in advance
Upvotes: 1
Views: 148
Reputation: 40576
Your branches do not contain divergent commits, so your history of modifications is just what the graph shows: a linear history.
If, for example, you made a new commit on cabang1
or master
(commit that is not part of cabang2
), then your graph would show what you expect:
git checkout cabang1
git commit -m 'divergent commit on cabang1' --allow-empty
Here's the output of git log --oneline --graph --decorate --all
before the commit:
* 91c2ad9 (HEAD, cabang2) cabang2
* 13a5e6c (cabang1) cabang1
* 478aa15 (master) 1st_commit
And here it is after the operation I have described above:
* 35be74c (HEAD, cabang1) divergent commit on cabang 1
| * 91c2ad9 (cabang2) cabang2
|/
* 13a5e6c cabang1
* 478aa15 (master) 1st_commit
Upvotes: 2