What is @ for in git command?

Mat Watershed

I came across a git expression, git show master@{3} and I have no idea what it's for and how to use it. I get it what is git show for but the puzzling part here is the @{3}. In my repo I did try this command, and terminal said fatal: Log for 'master' only has 1 entries., so couldn't figure it out from the message.
Could you anyone explain that for me and why I got this specific error. Thanks a ton.

choroba

See git help revisions for help.

@ alone is a shortcut for HEAD.

HEAD is explained in the same document:

HEAD names the commit on which you based the changes in the working tree.

And the curly brackets are described there, too:

@{<n>}, e.g. @{1}

You can use the @ construct with an empty ref part to get at a reflog entry of the current branch. For example, if you are on branch blabla then @{1} means the same as blabla@{1}.

So, @{3} points to the third prior reflog value from the entry of the current branch.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

What is a "switch" in a Git command?

git submodule sync command - what is it for?

What does the command git checkout "." do?

What is the purpose of "git push -u" command?

What is the effects of using the command git checkout?

git command alias in gitconfig: what characters to escape

What happens if i interrupt git add command?

What's the git command to distinguish a worktree folder

What's the meaning of `()` in git command SYNOPSIS?

What is the colored Git tool in Windows command line

what is difference of "develop" and "origin/develop" in command git

What is exactly meaning of commit command in git

What does this GIT command do while publishing a git project?

What is the `git restore` command and what is the difference between `git restore` and `git reset`?

What's the easiest way to use the output paths from a git command in a subsequent git command?

What is the correct order of git command I should use?

How can I see what are the steps involved in any git command

What plumbing command provides the same functionality as git log --follow?

What does 'master' mean in command "git branch --merged master"?

What's the Git command to determine which commit changed a submodule pointer?

Is there a git command to show what files are commited/edited by who?

IntelliJ IDEA - What is the keyboard shortcut for 'git pull' command?

What is the git command equivalent for this Visual Studio check box?

What git command do I need to keep a clean commit history?

What is to be done to fix Git log command failing from a Bitrise script

What is the correct command for performing a git-rebase in this scenario?

What is the git command xcode runs when clicking discard all changes?

lint-staged: what the purpose of 'git add' command

What does the argument "--add" mean in the "git config" command?