Creating new Refs

suggest change

Running git checkout -b <refname> will create a new ref that points to the current commit.

$ cat .git/HEAD
ref: refs/heads/main

$ git checkout -b TestBranch

$ cat .git/HEAD
ref: refs/heads/TestBranch

$ cat .git/refs/heads/TestBranch
1f324a

.git/HEAD names the current branch. The commit hash is stored in the branch ref. If that ref is packed, it may live in .git/packed-refs instead of .git/refs/heads/TestBranch.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents