Confirm Empty Repository with Branch Check
In this step, we will further confirm the initial state of our repository by checking the branches. Although git status
already told us we are on the master
branch, let's explicitly list the branches to see what's available.
Make sure you are still in the ~/project/my-time-machine
directory.
Use the git branch
command to list the branches:
git branch
Since this is a brand new repository and we haven't created any other branches, this command will likely show no output, or just indicate the current branch depending on your Git configuration. In a newly initialized repository with no commits, there isn't a fully formed branch history yet.
Let's try git branch -a
to see all branches, including remote ones (though we don't have any remotes yet):
git branch -a
Again, you might see no output or just the current branch. This confirms that our repository is indeed empty in terms of commit history and branches beyond the initial state.
Understanding branches is fundamental to Git. Branches allow multiple developers to work on different features or fixes simultaneously without interfering with each other's work. In a new repository, you start with a single default branch (often master
or main
). As your project grows, you'll create new branches for different tasks.