init: git status
In this video we'll revisit
I say revisit because we used
git status several times in Part 1.
git status is one of the commands, if not the command, you will use most often.
git status doesn't have many options, it does have a lot of output.
So we'll learn about the basic output in this video and go into more detail in Master: git status.
git status, we'll create an empty Git repository and run
Let's dissect the output.
git status tells us our current branch.
We'll learn about branches in Part 3.
For now, I only want to highlight its position and that the branch name is what appears in my prompt.
Again, don't worry if your prompt doesn't display the branch name. We'll set up your Git prompt in one of the Everyday Git videos.
git status outputs the current state of the repository.
In this case, it outputs nothing to commit, working tree clean.
In this case, Git doesn't see any changes to the repository.
As such, it reports there is nothing to commit and the working tree is clean.
Anytime Git uses the word working, you can substitute current or local. Anytime you see the word tree you can substitute branch or repository.
So, with these substitutions we can read this as, there are no changes, your current branch is clean.
Let's make some changes to vary the output of
I'll quickly make two new files and run
We see the output now includes details about these two new files.
I want to take this opportunity to point out that Git is very helpful.
Not only does it explain what the state of these files, but also suggests which Git command to use.
Most Git commands are like this.
There will be times you're running a lot of Git commands and one of them stops working.
When this happens, remember to slow down and read the output. More often than not Git will tell you what to do next.
So let's follow the advice and add one of these files with
git status one more time.
Again we see the output changed and the file we added is not listed as ready to be committed with the suggestion of using
git commit to record the change in the repository.
This covers the basics of
git status. We'll continue on to Master: git status to learn about these states in more detail.