The reason I ask is because I accidentally did git commit -athat included a file that I did not want to commit yet. My solution was to do the following:
git reset
git reset
git commit -C HEAD@{1}
Here Ive rewinds the branch by one commit, saving the index and working tree, then pulling file/with/changes_not_to_committedfrom an older version to the index, and then I passed the index using the commit message from the previous commit of the branch, Neither the call git-resetaffects the working copy, so my changes file/with/changes_not_to_committedare saved but are no longer recorded in the revision HEAD.
However, it would be easier if I could pull file/with/changes_not_to_committedfrom the version HEAD^directly to the index without touching the working copy. Since the index otherwise already represents the state I want, I could just make changes to the commit HEADby creating a sequence like this:
git magic-pony HEAD^ file/with/changes_not_to_committed
git commit
This is almost what I would get by replacing git-magic-ponywith git-checkout, except that the working copy will remain untouched and only the index will be updated. There seems to be no way to force git-checkoutboth to not be touched.
My question is: does it exist git-magic-pony, and if so, under what name?
source
share