Refs

suggest change

A ref is essentially a pointer. It’s a name that points to an object. For example,

"master" --> 1a410e...

They are stored as plain text files under .git/refs/heads/.

$ cat .git/refs/heads/mainline
4bb6f98a223abc9345a0cef9200562333

A branch is a ref stored under refs/heads/.

Now, it’s possible to navigate git purely by jumping around to different objects directly by their hashes. But this would be terribly inconvenient. A ref gives you a convenient name to refer to objects by. It’s much easier to ask git to go to a specific place by name rather than by hash.

Feedback about page:

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



Table Of Contents