Uploaded image for project: 'Sourcetree For Mac'
  1. Sourcetree For Mac
  2. SRCTREE-3679

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

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • General
    • None
    • Mac OS X El Capitan
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      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.

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

                Created:
                Updated: