Title: [7.7 Git Tools - Reset Demystified] - git reset with mode flag and pathspec · Issue #2031 · progit/progit2 · GitHub
Open Graph Title: [7.7 Git Tools - Reset Demystified] - git reset with mode flag and pathspec · Issue #2031 · progit/progit2
X Title: [7.7 Git Tools - Reset Demystified] - git reset with mode flag and pathspec · Issue #2031 · progit/progit2
Description: General overview of your idea. The section Reset With a Path illustrates the use of the reset command in the forms including a
Open Graph Description: General overview of your idea. The section Reset With a Path illustrates the use of the reset command in the forms including a
X Description: General overview of your idea. The section Reset With a Path illustrates the use of the reset command in the forms including a <pathspec>. It reads well and the example is clear but there is ...
Opengraph URL: https://github.com/progit/progit2/issues/2031
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[7.7 Git Tools - Reset Demystified] - git reset with mode flag and pathspec","articleBody":"### General overview of your idea.\n\nThe section `Reset With a Path` illustrates the use of the reset command in the forms including a `\u003cpathspec>`. It reads well and the example is clear but there is [this snippet about the syntax](https://github.com/progit/progit2/blob/55081eaf0bfb4b0f9bab287c0dd035bf604e43bc/book/07-git-tools/sections/reset.asc?plain=1#L220) that I think might be slightly confusing:\n```\nThis form (since you did not specify a commit SHA-1 or branch, and you didn't specify `--soft` or `--hard`) is shorthand for `git reset --mixed HEAD file.txt`...\n```\nUsing `--soft` or `--hard` in this form would actually raise an error (which makes sense) but the current wording makes it sound like they could have been valid choices. I was surprised to see that `--mixed` is allowed (even if it triggers a deprecation warning) but I guess that this implementation detail is the reason why the [git-reset documentation](https://git-scm.com/docs/git-reset) does not explicitly preclude the use of a `\u003cmode>` alongside a `\u003cpathspec>`.\n\nI can see why elaborations around `--mixed` were dropped there for the sake of clarity, so I think the snippet above would also become clearer if mentions to `\u003cmode>` were dropped altogether.\n\n\n\n### What problem will this solve?\n\nThe example in this section is good as it is, but some rephrasing would avoid potential confusion around mixing `\u003cmode>` with `\u003cpathspec>`, and also it would improve alignment between this section and the related documentation.\n\n### Have you thought about other solutions?\n\nI'd say it’s quite clear that the [git-reset documentation](https://git-scm.com/docs/git-reset) encourages the use of `\u003cmode>` only in the form:\n```\ngit reset [\u003cmode>] [-q] [\u003ccommit>]\n```\nwithout elaborating on the caveat that `--mixed` could be used beyond this case. \n\nIn the same spirit, I think that the snippet above could benefit from being rephrased to something along the lines of:\n```\nThis form (since you did not specify a commit SHA-1 or branch) is shorthand for `git reset HEAD -- file.txt`…\n```\nand perhaps adding a note with the caveat around `--mixed` if it's not too convoluted.\n\nWould this be worth a pull request? I know [a related issue](https://github.com/progit/progit2/issues/1187) was closed some years ago but in this case my point is not the warning when specifying `--mixed`.\n\n### Do you want to help with this enhancement idea?\n\nYes","author":{"url":"https://github.com/AlfaBetaBeta","@type":"Person","name":"AlfaBetaBeta"},"datePublished":"2025-04-30T22:21:17Z","url":"https://github.com/progit/progit2/issues/2031"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:28ae6bd2-33cb-40a1-8755-11fb07a49fb5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 98DC:301D56:65C3A8:8BBBFD:6AED8DDA |
| html-safe-nonce | dac1073e70c72dae2bc086314cdbc68cfe33777e09dec93adb75df4b6b9dfc1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OERDOjMwMUQ1Njo2NUMzQTg6OEJCQkZEOjZBRUQ4RERBIiwidmlzaXRvcl9pZCI6Ijg2NjYxNDcxNzc4NDg3MzcyNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cda21472d455da62929bf7757bf61812786a0049af13209b70df8d10b282fb30 |
| hovercard-subject-tag | issue:3032679864 |
| github-keyboard-shortcuts | repository,issues,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/issues/show/progit/progit2/2031/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35a50113de78a65b199fe8be1c5c220a1fcaaa252953cbf76794d599e77e0e62/progit/progit2/issues/2031 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35a50113de78a65b199fe8be1c5c220a1fcaaa252953cbf76794d599e77e0e62/progit/progit2/issues/2031 |
| og:image:alt | General overview of your idea. The section Reset With a Path illustrates the use of the reset command in the forms including a |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlfaBetaBeta |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/progit/progit2 git https://github.com/progit/progit2.git |
| octolytics-dimension-user_id | 95588 |
| octolytics-dimension-user_login | progit |
| octolytics-dimension-repository_id | 15400220 |
| octolytics-dimension-repository_nwo | progit/progit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 15400220 |
| octolytics-dimension-repository_network_root_nwo | progit/progit2 |
| 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 | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width