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

Git reset hard does not reset modified files if they are excluded in .gitignore #819

Closed
daolis opened this issue Jul 26, 2023 · 0 comments
Closed

Comments

@daolis
Copy link
Contributor

daolis commented Jul 26, 2023

It happens in some cases that after the checkout of an branch the worktree is in unClean state.

If you want to reset this changes (withg Mode: git.HardReset) everything should be reverted.

BUT: If the modified file is also excluded in the .gitignore file then this file is not reverted.
If you run the command with the git console client (git reset --hard) all is reverted as expected.

Test application to reproduce the issue: https://github.com/daolis/gogit-reset-bug

This behaviour was introduced with cf51e2febf37 #718
FYI @cbbm142 @pjbgf

@daolis daolis changed the title Git reset hard does not reset modified files if they are excluden in .gitignore Git reset hard does not reset modified files if they are excluded in .gitignore Jul 28, 2023
daolis added a commit to daolis/go-git that referenced this issue Sep 4, 2023
@pjbgf pjbgf closed this as completed in 753b0d5 Sep 4, 2023
pjbgf added a commit that referenced this issue Sep 4, 2023
git: worktree, reset ignored files that are part of the worktree: Fixes #819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant