DEV Community

Baldo Bo
Baldo Bo

Posted on • Updated on

Git

First-Time Git Setup

This is a summary of the git official docs

Your identity

The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Enter fullscreen mode Exit fullscreen mode

Your default branch name

By default Git will create a branch called master when you create a new repository with git init. From Git version 2.28 onwards, you can set a different name for the initial branch.

To set main as the default branch name do:

$ git config --global init.defaultBranch main
Enter fullscreen mode Exit fullscreen mode

Checking your settings

If you want to check your configuration settings, you can use the git config --list command to list all the settings Git can find at that point:

git config --list
Enter fullscreen mode Exit fullscreen mode

Top comments (0)