DonJayamanne / gitHistoryVSCode

Git History for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory
MIT License
952 stars 154 forks source link

Add support to the git reset command #380

Open fadc80 opened 5 years ago

fadc80 commented 5 years ago

What about adding the reset command as an option when you click on a specific commit? I mean, as EGit Eclipse plugin does (pop up option)...

DonJayamanne commented 5 years ago

Do you mean revert a commit?

fadc80 commented 5 years ago

I meant adding support to the git reset command. A good option to undo local commits. It can be used to rewind your current HEAD branch to a specific revision. For example, the following command undo the last commit:

git reset --soft HEAD~1

It rewrites the history tree like a rebase does, but it's safe for changes only committed locally.

The [EGit Eclipse plugin]() support this command through its history view:

history-reset

The revert command you mentioned works differently. It adds one or more commits that undo a specific previous commit. It doesn't rewrite the history tree. Therefore, it's a better option when you have changes already pushed to a remote repository.

demurgos commented 5 years ago

I agree, it would be nice to have a way to use git reset --hard or git reset --soft to move the current branch to a given commit. It is especially useful when working on a branch locally and then preparing it to be pushed by cleaning up the history.