Use git config to Verify Upstream
In the previous step, we saw that git branch -vv
showed [origin/master]
. This indicates that our local master
branch is configured to track the master
branch on a remote named origin
. Even though we haven't added a remote yet, Git has default configurations that suggest this tracking relationship.
We can verify this configuration using the git config
command. This command allows us to view and modify Git's configuration settings.
Make sure you are still in the ~/project/my-time-machine
directory.
Now, let's check the configuration for our master
branch's remote:
git config branch.master.remote
This command specifically asks Git for the value of the remote
setting for the master
branch.
You should see the output:
origin
This confirms that the master
branch is configured to use origin
as its remote.
Next, let's check the configuration for the remote branch name that our local master
branch tracks:
git config branch.master.merge
This command asks Git for the value of the merge
setting for the master
branch, which specifies the remote branch to merge into the local branch.
You should see the output:
refs/heads/master
This confirms that the master
branch is configured to track the master
branch on the remote. refs/heads/master
is the full reference name for the master
branch.
Using git config
is a powerful way to understand and manage the detailed settings of your Git repository, including how your local branches interact with remote repositories.