Lets learn how to navigate between the repository branches
Now your project has two branches:
RUN:
git hist --all
RESULT:
$ git hist --all
* 07a2a46 2020-01-09 | Updated index.html (HEAD, style) [kwikl3arn]
* 649d26c 2020-01-09 | Hello uses style.css [kwikl3arn]
* 1f3cbd2 2020-01-09 | Added css stylesheet [kwikl3arn]
* 8029c07 2020-01-09 | Added index.html. (master) [kwikl3arn]
* 567948a 2020-01-09 | Moved hello.html to lib [kwikl3arn]
* 6a78635 2020-01-09 | Add an author/email comment [kwikl3arn]
* fa3c141 2020-01-09 | Added HTML header (v1) [kwikl3arn]
* 8c32287 2020-01-09 | Added standard HTML page tags (v1-beta) [kwikl3arn]
* 43628f7 2020-01-09 | Added h1 tag [kwikl3arn]
* 911e8c9 2020-01-09 | First Commit [kwikl3arn]
To switch between branches simply use the git checkout
command.
RUN:
git checkout master
cat lib/hello.html
RESULT:
$ git checkout master
Switched to branch 'master'
$ cat lib/hello.html
<!-- Author: kwikl3arn (kwikl3arn@gmail.com) -->
<html>
<head>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Now we are on the Master branch. It can be proven by the fact the hello.html
file does not use styles from style.css
.
RUN:
git checkout style
cat lib/hello.html
RESULT:
$ git checkout style
Switched to branch 'style'
$ cat lib/hello.html
<!-- Author: kwikl3arn (kwikl3arn@gmail.com) -->
<html>
<head>
<link type="text/css" rel="stylesheet" media="all" href="style.css" />
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
We are back to the style branch which can be proven by the fact the hello.html
file uses styles from style.css
.