diff --git a/git.md b/git.md index 7442d36..42136ea 100644 --- a/git.md +++ b/git.md @@ -2,10 +2,29 @@ ## Table of contents -- [git submodule](#git-submodule) +- [branches](#branches) + - [create a branch](#create-a-branch) +- [submodules](#submodules) -## git submodule +## branches + +### create a branch + +To create a branch use subcommand `branch` or `checkout` with flag `-b`: +```bash +# create new branch ('base-branch' is optional) +git branch +git checkout -b + +# switch branch ('checkout -b' combines the 'branch' and 'switch' subcommands) +git switch +``` + + +## submodules + +To fetch submodules of a cloned repository use: ```bash # do it manually git submodule init @@ -16,4 +35,4 @@ git clone --recurse-submodules # if repo is already cloned git submodule update --init --recursive -``` \ No newline at end of file +```