Search code examples
gitrevert

Can someone explain 'git revert ...'


I read the post: how-do-i-revert-all-local-changes-in-git-managed-project-to-previous-state, which is a very good post / answer, so plus 1's all around.

I understand all the commands that are mentioned, except this one:

git revert ...

What do the dots mean? - I am sure the answers are on the web, but the search engines seem to ignore punctuation, so I get hundreds of pages of basic git revert with no other mentions of "...".


Solution

  • The three dots are meant as a placeholder (meaning that you should replace the three dots with an actual argument). They are used as an ellipsis (which is confusing, as ... also has special meaning as a range operator for Git).

    The manual page may be helpful:

    $ man git-revert
    
    NAME
           git-revert - Revert some existing commits
    
    SYNOPSIS
           git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
    

    So git revert expects a <commit> argument (without the angle brackets). The three dots here indicate that you can also pass more than one <commit> argument.