Skip to content

[why] git branch

What If We Dig Deeper edited this page Feb 4, 2018 · 3 revisions

branch is a reference to a commit. Stored in .git/refs folder.

HEAD is just a reference to a branch. Stored in .git/HEAD

# creates a develop branch, but does not re-point HEAD to it.
git branch develop

# create branch and checkout
git checkout -b feature/4323-edit-settings

# 1. move HEAD to develop branch
# 2. replace the working directory
git checkout develop
Clone this wiki locally