Create a new branch and do work on it

Create a new topic branch with a name that indicates the work to be done on it:

git branch root-route

Run gloga.

Note that there is now a new branch pointer root-route that points at the same commit as HEAD. Also, note that HEAD still points at main (so main is still the branch we’re on).

Switch to the root-route branch:

git switch root-route

Run gloga.

Note that HEAD now points at root-route instead of main. We are now on the root-route branch.

In VS Code, add to the routes.rb file the following line right before the resources line:

root to: redirect('/people')

Test that this root route works by running the server and opening http://localhost:3000. The browser should automatically be redirected to the people index page. Halt the server once you confirm that it works.

Run git add -A to stage all changes for commit.

Run git commit and enter the log message, “Add root route”, to commit the staged changes.

Run gloga.

Note that a new commit has been created, and root-route points at it (along with HEAD still pointing at root-route). Also note that main has not moved, still pointing at the previous commit.

Try adding more commits to this branch. For example, you might make changes to the HTML.ERB view files. After you make each new commit, use gloga to check how the repo changed.


⏴ Back Next ⏵