Viewing the DAG
The history in Git is formed from the commit objects; as development advances, branches are created and merged, and the history will create a directed acyclic graph, the DAG, due to the way Git ties a commit to its parent commit. The DAG makes it easy to see the development of a project based on the commits. Please note that the arrows in the following diagram are dependency arrows, meaning that each commit points to its parent commit(s), hence the arrows point in the opposite direction of time:
Viewing the history (the DAG) is built into Git by its git log
command. There are also a number of visual Git tools that can graphically display the history. This section will show some features of git log
.
Getting ready
We will use the example repository from the last section and ensure that the master branch is pointing to 34acc37
:
$ git checkout master && git reset --hard 34acc37
In the previous command, we only...