Created
May 30, 2024 15:48
-
-
Save joe-oli/b3f71bf1071e41e0be3aeae05d495cb3 to your computer and use it in GitHub Desktop.
Git notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you initialize a new Git repository with `git init`, Git creates a single branch named `master` by default. This is the branch where your initial commit will go when you make it. | |
However, starting from Git 2.28, you can customize this behavior using the `init.defaultBranch` configuration option. For example, if you want your default branch to be named `main`, you can set this option globally with the following command: | |
```bash | |
git config --global init.defaultBranch main | |
``` | |
After running this command, new repositories you create with `git init` will have a single branch named `main` by default. | |
Please note that this does not rename the default branch in existing repositories. For that, you can use the `git branch -m` command. If you have any more questions, feel free to ask! 😊 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment