Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: discard changes support for SourceControlToolbarBottom #1480

Merged
merged 5 commits into from
Nov 20, 2023

Conversation

EstebanBorai
Copy link
Member

@EstebanBorai EstebanBorai commented Nov 12, 2023

Description

Provides support to discard all unstagged changes in the repository by spawning tho
git restore . command.

Related Issues

Based on todo.

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

CleanShot.2023-11-12.at.21.01.02.mp4

@EstebanBorai EstebanBorai marked this pull request as ready for review November 13, 2023 00:09
@EstebanBorai EstebanBorai changed the title feat: SourceControlToolbarBottom discard changes dialog feat: discard changes support for SourceControlToolbarBottom Nov 13, 2023
@nanashili
Copy link
Contributor

Reatore is not the right call you should be making. You should be using 'reset -- .'

@EstebanBorai
Copy link
Member Author

Reatore is not the right call you should be making. You should be using 'reset -- .'

Hi @nanashili, thanks for the bringing this up!

I used git restore . because what I want to do is discard all changes instead of resetting the history.

git restore its more semantic for our use case as well, as what we want to do is discard
changes, its as well, the command being used on single files.

Given that we are prompting for Discard Changes for current repository state, and also that Discard Changes in the context of a single file used git restore, I thought this
approach is more semantic and predictable.

@EstebanBorai
Copy link
Member Author

Another consideration is that git reset also provides different variants, so the user flow would be a bit different.

As a matter of fact, Visual Studio Code also uses this approach, if you want to apply git reset from the UI you should use a Git extension like GitLens.

I would also make the operation of git reset explicit, and would consider its variants (--soft, --hard), I think it would fit better in a Reset History button/feature.

@EstebanBorai
Copy link
Member Author

Just saw sfitlint issues! Will fix and push soon!

0xWDG
0xWDG previously approved these changes Nov 18, 2023
thecoolwinter
thecoolwinter previously approved these changes Nov 20, 2023
Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for getting this done!

@austincondiff austincondiff merged commit da2350f into CodeEditApp:main Nov 20, 2023
2 checks passed
@thecoolwinter thecoolwinter added the enhancement New feature or request label Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants