Reset to Commit on deleted file in past commit when path no longer exists fails

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: General
    • None
    • Environment:
      Mac OS X El Capitan

      When I do a "Reset to Commit" on a file that was previous deleted in a past commit and that path no longer exists, the command fails with

      error: pathspec 'error: pathspec 'scripts/queries/some_file_name.sql' did not match any file(s) known to git.'
      

      When I look at the command that was issued, it is calling reset (which is technically correct), but that will not work because the path really does not exist (except back in the previous commit). I added a custom command to fix this so I can do it without having to use the command line. That command is this

      git checkout $SHA^ -- $FILE
      

      While using a custom command works just fine, it would be nice if that Reset to Commit was smart enough to detect if that path still exists and then based on that info, either use the "git reset" command if it does exist, otherwise use the "git checkout sha^" command if that path does not exist.

            Assignee:
            Unassigned
            Reporter:
            toddbluhm
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: