Earlier quoted context omitted.
You'd probably really like Magit mode for Emacs then. What you're describing with interactive add becomes trivial since you can stage parts of the diff by selecting them in a region. I can hardly live without Magit these days. Bonus is that it even works on remote hosts via tramp.
With the vim-gitgutter plugin installed, you can dynamically add/remove/undo hunks without even leaving the editor[0]. I use this instead of `git add -p` nowadays [0]: https://github.com/airblade/vim-gitgutter#getting-started
Git Undo
21–30 of 175 posts
Re: Git Undo
#22Most git command-lines are lengthy enough to give me time to consider them, so I don't often feel the need to "take back" a git invocation. What I do often screw up, though, is the (almost hypnotic) tapping of y/n when doing a `git {add, reset, checkout} -p` to prepare and clean up a commit. Ideally, with all of the -p commands, git wouldn't actually apply any of the changes I specified until it was about to quit (i.…
You'd probably really like Magit mode for Emacs then. What you're describing with interactive add becomes trivial since you can stage parts of the diff by selecting them in a region. I can hardly live without Magit these days. Bonus is that it even works on remote hosts via tramp.
Re: Git Undo
#23This seems dangerous to get used to. I always thought the reflog was supposed to be last-resort. Isn't it?
Re: Git Undo
#24Why not just use a filesystem which supports snapshots? It would allow you to go back without even invoking git.
Re: Git Undo
#25Warrants a big warning that using `reset --hard` will irreversibly wipe out any uncommitted changes.
Re: Git Undo
#26Warrants a big warning that using `reset --hard` will irreversibly wipe out any uncommitted changes.
Came here for this. git undo won't restore the changes wiped out by reset --hard? They aren't stored on the reflog?
Re: Git Undo
#27I worry about naming a function undo that doesn't necessarily undo what the user expects. Undo has a strong user expectation, and I'm not convinced this matches that.
Git already has `git branch` which doesn't in fact do any kind of branching but creates a label which follows commits when it's checked out.
Re: Git Undo
#28 cancel = reset --soft HEAD^
I don't want an alias to hard reset, it seems to dangerous and a good way to lose some work. However a soft reset like this allow me to cancel the last commit and add an omitted file, or remove one from the commit, or simply to correct the commit message easily.Re: Git Undo
#29I worry about naming a function undo that doesn't necessarily undo what the user expects. Undo has a strong user expectation, and I'm not convinced this matches that.
Git already has `git branch` which doesn't in fact do any kind of branching but creates a label which follows commits when it's checked out.
Re: Git Undo
#30I freely admit to being an Hg fan, but that this stuff is accepted as common practice kinda blows my mind. What's so wrong with keeping an accurate picture of history that people do all kinds of manipulation to their history to keep from the VCS system from accurately reflecting history of development?
But it's equally valid to consider all your commits important in my history as well. It just depends on what you want. Personally, I never rebase, but I can understand why some people like that feature.