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

"failed to remove" error leads to lost untracked and ignored files? #236

Open
duckdalbe opened this issue Oct 14, 2020 · 1 comment
Open

Comments

@duckdalbe
Copy link

Maybe I'm using gitless wrong, in that case I'd appreciate a pointer! But to my understanding it just deleted my untracked files in a repository.

Here's a reconstructed flow of the commands I used, I hope it makes sense.

> gl status
On branch develop, repo-directory //

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    tracked-file1


Untracked files:
  ➜ these won't be considered for commit
  ➜ use gl track f if you want to track changes to file f

    untracked-file1
    untracked-file2
> gitless branch -c new-branch
✔ Created new branch new-branch
> gitless switch new-branch
✘ b'warning: failed to remove ignored-file1: Permission denied\nwarning: failed to remove ignored-file2: Permission denied\n…
> gl status
On branch develop, repo-directory //

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    tracked-file1


Untracked files:
  ➜ these won't be considered for commit
  ➜ use gl track f if you want to track changes to file f

    There are no untracked files to list
> git stash # saving my changes before fixing the problem
> sudo chown …
> gl switch new-branch 
✔ Switched to branch new-branch
> gl status
On branch new-branch, repo-directory //

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    There are no tracked files with modifications to list


Untracked files:
  ➜ these won't be considered for commit
  ➜ use gl track f if you want to track changes to file f

    There are no untracked files to list
> gl switch develop
✘ b'error: stash@{0}|*|On develop: -- ---gl-develop---|*|\n|*|stash@{2} is not a valid reference\n'
> gl status
On branch develop, repo-directory //

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    There are no tracked files with modifications to list


Untracked files:
  ➜ these won't be considered for commit
  ➜ use gl track f if you want to track changes to file f

    There are no untracked files to list
> ls "ignored-file*"
ls: cannot access 'ignored*': No such file or directory

After I fixed the file permissions I can switch to new-branch, as you see. But my untracked files and also the ignored file are gone. Is that intended behaviour? Is it due to me using git stash in the middle? None of git's stashes contain my ignored files, though.

I'm not a beginner with git and other VCS, but I didn't find a way to get my untracked and ignored files back — which freaks me out, I have to say. Is there something I'm overlooking or misunderstanding?

@duckdalbe
Copy link
Author

By reading gitless' code I learned that it uses git stash --all internally, which helped to get my lost data back.

I'm still astonished by gitless' behaviour in this case.

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