Challenge¶
- Create a directory named
softball/ - Initialize a git repo inside it.
- By default, the initial branch will be named
main. Name itboogerinstead.
Solution¶
cd ~/Desktop
mkdir softball
cd softball
git init --initial-branch=booger
Explanation¶
-
cd(change directory) into~/Desktop/cd ~/Desktop -
mkdir(make directory)softball/.cd ~/Desktop mkdir softball -
cdintosoftball/, since that's where we want the git repo to live.cd ~/Desktop mkdir softball cd softball -
Initialize the git repo with
git init.cd ~/Desktop mkdir softball cd softball git init --initial-branch=boogerThe
--initial-branchflag lets us name the initial branch name something other thanmain(the default name).
How do I change the initial branch name after creating it?
You can rename the current branch using git branch -m <newname>. So,
git init --initial-branch=booger
could also be accomplished by
git init
git branch -m booger
git help
You can use
git <command> -hto see how to use a git command orgit help <command>to read the full docs regarding the command.