Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Git HEAD@{x}

Tags:

git

I saw code examples using HEAD@{1}.

While reading about HEAD I saw the difference between HEAD~ and HEAD^ but what does this mean or where can I read more about the HEAD@?

like image 892
Laoujin Avatar asked Feb 19 '26 02:02

Laoujin


2 Answers

HEAD@{1} is the reference before HEAD@{0} (which is the current HEAD).

Everything you're looking for can be found in the gitrevisions documentation. Additionally the git reflog documentation should be helpful too.

like image 84
blue112 Avatar answered Feb 21 '26 16:02

blue112


Git logs every change to HEAD in what is called reflog. Run git reflog to see. The HEAD@{x} will refer to the commit in that log.

like image 29
Sukima Avatar answered Feb 21 '26 16:02

Sukima



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!