Session Ready
Exercise

Commit added files

GitPython gives us building blocks that we can use to build Python scripts that make our use of version control faster, easier, and more efficient.

Version controlled projects usually start with initializing or cloning repositories.

After a repository is set up, the standard cycle of commands is add and commit changes.

In this exercise, we will focus on the first two steps: adding changes to the index and committing them to version control history.

The commit message is created by an f-string, which evaluates the code inside curly braces ({}).

With GitPython, we can initialize a new repository and instantiate the Repo class in one line of code.

We can then check for untracked files, add files to the index, commit changes, and list all of the newly tracked files.

Instructions
100 XP
  • Initialize a new repo in the current folder and instantiate the Repo class.
  • Add all of the currently untracked files to the index.