Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876 · GitHub
Open Graph Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876
X Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876
Description: What's wrong with resetting with both --mixed and paths?
Open Graph Description: The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecated. # See h...
X Description: The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecate...
Opengraph URL: https://github.com/gitpython-developers/GitPython/discussions/1876
X: @github
Domain: togithub.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"What's wrong with resetting with both --mixed and paths?","text":"The HEAD.reset method includes this code:
\n\n \n \n GitPython/git/refs/head.py\n
\n \n Lines 97 to 105\n in\n e880c33\n
\n \n \n \n\n \n \n if index: \n \n\n \n \n mode = \"--mixed\" \n \n\n \n \n \n \n\n \n \n # Tt appears some git versions declare mixed and paths deprecated. \n \n\n \n \n # See http://github.com/Byron/GitPython/issues#issue/2. \n \n\n \n \n if paths: \n \n\n \n \n mode = None \n \n\n \n \n # END special case \n \n\n \n \n # END handle index \n \n
\n \n\n\nThe issue URL is broken and seems it may not be archived. Is more known about this issue, and is there anything that can be replaced with?
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"Although I can't be certain there isn't further relevant information in the lost issue, I think I've figured this out. It's much more straightforward than I'd feared and indeed trying it out as you suggested in #1876 (comment) led directly to the answer.
\nRunning git reset --mixed -- path always shows a warning. For example:
\n> git diff --staged --stat\n git/__init__.py | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)\n> git reset --mixed -- git/__init__.py\nwarning: --mixed with paths is deprecated; use 'git reset -- <paths>' instead.\nUnstaged changes after reset:\nM git/__init__.py\n
\nThe suggestion of what to do instead was added in git/git@a4941a8, but the behavior of issuing a deprecation message is older than that.
\nIt looks like it came in at git/git@0e5a7fa when git-reset was changed from being implemented as a shell script git-reset.sh (retained as an example, then later removed in git/git@49eb8d3 along with other such examples) to a builtin implemented in a newly introduced builtin-reset.c. The first stable version of git to include these changes was 1.5.4, whose release notes mention git reset becoming a builtin but do not mention the deprecation of passing paths after --mixed. But it is not to be found in the old shell script.
\nAs for why one shouldn't write --mixed when passing paths, it seems the idea is that a reset with paths--which must always have the same effect as when --mixed is passed--is already just its own separate kind of operation from other resets. Anyway, the approach taken in the code of simply omitting --mixed, not passing --hard or --soft either, and still passing the paths after --, seems to be robust and congruent with the expanded deprecation message.
\nI'll open a small PR to clarify the comment.
","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1876#discussioncomment-8975656"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:0bd26105-7220-20fb-b10c-4bca381c1b6f |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | A7D0:FD1E:18E91DD:23726AB:69690B97 |
| html-safe-nonce | 0dd239921680bff47e30f892cf56a71e7d421cdd9a279b2db9d9f86b2cf386fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0QwOkZEMUU6MThFOTFERDoyMzcyNkFCOjY5NjkwQjk3IiwidmlzaXRvcl9pZCI6IjYwMzkwODk3ODM2NTQzODY1ODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f509be2a95ed0e8ad1ed4eb78876f72ea7aed5170ee481437cea4751b5ee82dc |
| hovercard-subject-tag | discussion:6371726 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/gitpython-developers/GitPython/1876/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/41d989b35470a2f11e8d23cb577f79f9be72407f5edf11fc3ba0a0f4ba9ede69/gitpython-developers/GitPython/discussions/1876 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41d989b35470a2f11e8d23cb577f79f9be72407f5edf11fc3ba0a0f4ba9ede69/gitpython-developers/GitPython/discussions/1876 |
| og:image:alt | The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecated. # See h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e6156bd4ef9f2dc8dadf4c49a8f7ed8532186388cef72eda3ccb9f0ab3b8cfca |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ee2210c3e58153aae53400c942f8a7b4bbb43ec4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width