gitkraken / vscode-gitlens

Supercharge Git inside VS Code and unlock untapped knowledge within each repository — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more
http://gitkraken.com/gitlens
Other
9.02k stars 1.34k forks source link

Much more powerful git history editing #884

Open brianjmurrell opened 5 years ago

brianjmurrell commented 5 years ago

When working on a feature or bugfix with git, I will commit early and often as I iterate towards the final solution. I rarely want to commit such an array of arbitrary commits. At minimum I will want to squash them. But often, there is debug prints and so forth that I might want to reorder and eventually get rid of. All of this happens on a private branch where rebasing and force pushing is acceptable because nobody else should be working on the same branch.

It would be nice if gitlens automated much of this history rewriting. The sorts of operations I think would be useful are:

  1. Reorder commits (dragging them around in history)
  2. Squash (some range of) commits
  3. Commit new code to previous commit (i.e. commit + squash to previous)
  4. Split commit
  5. Once all of the above is done, force push to remote branch

So, indeed all of those above except the last are different forms of git rebase -i. Many will cause conflicts, but those can be handled the way VS Code already handles conflicts when doing a git rebase -i from the terminal window.

The above operations are probably what I jump out of VS Code to a terminal most often for.

fsackur commented 4 years ago

Hi, for quite a while I used to rely on having $Env:EDITOR = 'code --wait' (Powershell) - then at least I didn't have to leave Code to do an interactive rebase. I suspect EDITOR="code --wait" would work on bsd/nix.

I note that a gui rebase editor is planned for v11. It has drag-n-drop.

mpictor commented 3 years ago

A few related features I'd like to see, in the interactive rebase editor: