microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.74k stars 28.17k forks source link

Git: Support interactive rebase #31153

Open cleidigh opened 6 years ago

cleidigh commented 6 years ago

Since it is typical for projects like Code and others to have PRs with a single command for brevity and cleanliness, this feature would be really helpful to not have to go into the terminal.

Willing to do a PR...

cleidigh commented 6 years ago

@joaomoreno Would you accept a PR on this? Or do you want to keep it internal?

joaomoreno commented 6 years ago

I'm not sure how this could look like. What are your thoughts?

cleidigh commented 6 years ago

@joaomoreno

As stated before , the use case is mainly cleaning up local commits in preparation for single commit PRs as is preferred for projects like VSC

cleidigh commented 6 years ago

@joaomoreno I guess the other option is doing this through an extension (GitLens) if you think that would be better. Either way it would be great to have your opinion on the approach above.

joaomoreno commented 6 years ago

I think getting started with an extension would be a great way to prototype this thing. Gitlens would not be ideal since it seems that extension, though powerful, dedicates itself to a read-only view of repositories.

Since git is now an extension, it could actually expose API to other extensions to give them the full power of git: #31103. This could open the door to explore new features as extensions, such as the one we mention here.

Finally, one thing seems to be missing from this story: squashing is but a small part of a much powerful feature, rebasing, which we should probably tackle first.

cleidigh commented 6 years ago

@joaomoreno Great. Thanks for discussion points ! I get that rebasing is the main feature. Let me to do more research as I am no git guru then I will put out a proposal for an extension approaching rebasing first.

Should I change the title of this issue to reflect a discussion on rebasing?

benc-uk commented 5 years ago

Any update on this? Would be really good to have squash supported directly by VSCode with the UI supporting it

jmbockhorst commented 5 years ago

I have started working on some initial rebase features. Here is what I have so far:

When a rebase is in progress, the rebase command shows the "Continue", "Abort", and "Skip" options.

Rebase from a branch

This command lets you choose a branch to rebase onto the current branch. If there are any conflicts, you can resolve them manually and run the "Rebase: Continue" command. Repeat this process until all conflicts are resolved (like you normally would with git rebase) and it tells you that the rebase is complete.

rebaseBranch

Consolidate commits

This command lets you choose a commit to consolidate back to, and then opens up the git interactive rebase file for editing. The ability to squash all commits and add a new commit message without having to edit the text file could be a specific option added in the future.

rebaseConsolidate

Feedback would be appreciated on what other features to add and how it looks so far. Thanks!

antonholmberg commented 5 years ago

@jmbockhorst That is exactly what i want! Looks amazing. Will it be released to insiders?

jmbockhorst commented 4 years ago

Any feedback on the above rebasing features? Should I create a PR as it is currently?

senolfeldmann commented 4 years ago

This is exactly what I miss after switching from SmartGit to VS Code for git. So, please create a PR :)

wmertens commented 4 years ago

Some possible features, borrowed from https://github.com/git-up/GitUp:

Kurt-von-Laven commented 3 years ago

@jmbockhorst would you be willing to open a PR with the impressive features you demoed? If more features are desired, they could go in a separate PR, or someone else could build atop of your hard work.

holbrookdev commented 2 years ago

This fixed it for me:

git config --global core.editor "code --new-window --wait"

The difference from prior solutions is the --new-window option which forces to open a new window.

Past Issues:

phil-blain commented 2 years ago

Now that VSCode for the web and github.dev exist, it would be really nice to be able to do an interactive rebase using the VSCode UI, since these environments lack a terminal.

kasperk81 commented 10 months ago

any updates? lack of interactive rebase in github.dev is a huge pain!

AnthonyMastrean commented 10 months ago

I'd say Continue and Abort operations are needed for the normal Merge and Cherry-Pick workflows, too. #193042