Skip to content

Commit

Permalink
🚚 update: Add command for changing default branch name (#6)
Browse files Browse the repository at this point in the history
Add command to `git_config.adoc`
  • Loading branch information
HarshKapadia2 committed Feb 20, 2021
1 parent 841b375 commit 6a48d1d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/content/commands/git_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ Get and set repository or global options.

===== --global

* `git config --global user.name '<name>'`
* `git config --global user.email '<e-mail_id>'`
* Set user's name: `git config --global user.name '<name>'`
* Set user's e-mail: `git config --global user.email '<e-mail_id>'`

NOTE: The global name and e-mail need to be set just once, ie, before Git is used for the first time (but it can be modified later if need be).

TIP: Enter the full name and the e-mail ID registered with your GitHub account.
[NOTE]
====
* It is mandatory to fill in these two details.
* Please enter the e-mail ID registered with the concerned GitHub/GitLab/BitBucket account and the full name.
* This is the name and e-mail ID that will be associated with each commit.
* The global name and e-mail need to be set just once, ie, when Git is used for the first time ever on a computer (but can be modified if need be).
====

* link:#_aliases[Aliases] can also be set using this flag.

* Change default link:#_branches[branch] name created on running link:#_git_init[`git init`] command: `git config --global init.defaultBranch '<branch_name>'`

TIP: New **GitHub** repositories have their default branch name as `main` instead of the usual `master`, while Git still uses `master` as the default branch name for new repositories. This creates a mismatch, due to which link:#_git_push[pushes] fail. To combat this change on GitHub, it would be recommended to change the default branch name of Git locally to `main` using the above command.

===== --list
* Lists the configurations of Git.
* Eg: `git config --list`
Expand Down

0 comments on commit 6a48d1d

Please sign in to comment.