You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to replicate the Mercurial uncommit command. Synopsis:
gg uncommit [FILE [...]]
uncommit part or all of a local commit
Running gg uncommit without any arguments should behave like git reset --soft HEAD~.
Running gg uncommit with arguments should do something like:
# Update index with previous state of files, but don't modify the working tree.
git reset -q HEAD~ -- FILE1 FILE2 ...
# Now roll back the HEAD ref.
git reset --soft HEAD~
Tricky part will be to ensure this works on the first commit as well: this shouldn't introduce any bugs like #30.
Correction: in the second case, it should amend the top commit to point to old content.
Oddly enough, I think the easiest way to implement this might be to read the HEAD tree, rewrite the content to point to the blobs for the given files at HEAD~, use git-commit-tree to create the new commit, then git reset --soft NEW_COMMIT_HASH. For merge commits, this would only work if the content of the blob was the same in all parents (it should error otherwise).
It would be nice to replicate the Mercurial uncommit command. Synopsis:
Running
gg uncommit
without any arguments should behave likegit reset --soft HEAD~
.Running
gg uncommit
with arguments should do something like:Tricky part will be to ensure this works on the first commit as well: this shouldn't introduce any bugs like #30.
/cc @ianthehat, who requested this feature.
The text was updated successfully, but these errors were encountered: