AndreaNobili AndreaNobili - 4 months ago 13
Git Question

How exactly mean this graph obtained by git log?

I am absolutly new in GIT and I have the following doubt.

Into a project on which I am working on I do:

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git branch
* master


So it should bean that I have only the master branch in this project. Is it my interpretation correct?

Then I want to see the graph related to the commitment of this project performing:

git log --graph --oneline --decorate=full --all


and this is my output:

Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids (master)
$ git log --graph --oneline --decorate=full --all
* cba1887 (HEAD -> refs/heads/master) fixing: fixed the bug related of the weapo
n 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
* f19cb1b Fix typo in space
* 75928a9 Use space for movement and enter for shooting
* ac83b72 mostly finished ipad version
* 7ca4826 trying to get div touch controls to work

....................................................................
....................................................................
....................................................................


So I think that it means:

1) The last commit have id cba1887 and this commit is into the master branch.

My problem is on this section of the graph:

* 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
|/


So it seems to me that it is creating a new branch having id df03538 (the branch can have an ID or am I missing something?) and label I can't spell 'screen' apparently :).

This branch contains 4 commits with ids 354dfdd, 0c6daf1, a3c0ae4, 656b02e.

Is it my interpretation correct or am I missing something?

If my interpretation is correct and this is a new branch why I can't see it into the list of branches obtined by the previous git branch statment that show only the master branch?

Answer

Is it my interpretation correct or am I missing something?

No, the line * df03538 I can't spell 'screen' apparently :), is a unit which denotes a commit in your master branch.

Meanwhile, * 354dfdd (refs/remotes/origin/coins) Make ships able to spawn on coins is the last commit of the branch you talked about.

why I can't see it into the list of branches obtained by the previous git branch statement that show only the master branch?

Here refs/remotes/origin/coins as the only ref means it's a remote branch, which you haven't checked out locally, you can actually see it via:

git branch -a

And, you can checkout it via:

git checkout -t origin/coins

This will create a local branch named coins which also tracks origin/coins, and you'll be able to see it via git branch.

Comments