DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

Notice that the first entry is the current commit state, as
it is referenced by HEAD. The other entries show the
chronological history of the commits. Figure 2-11 shows a
visual representation of this simple three-step commit
history; for brevity, only the first four values of the hash
are used.


Figure 2-11 Git Commit History


To add a Git branch, you simply issue the git branch
command and supply the new branch with a name, using
the following syntax:


Click here to view code image


git branch (-d) <branchname> [commit]

You can alternatively specify a commit identified by a tag
or commit hash if you want to access a previous commit
from the branch history. By default, Git selects the latest
commit. In addition, you can delete a branch when you
no longer need it but using the -d argument. The
following example shows how to create a branch and
display the current branches with the git branch
command with no argument:


# git branch newfeature
# git branch
* master
newfeature
Free download pdf