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

Squash commits do not remember if the file was just removed from being cached #18331

Open
EmosewaMC opened this issue Mar 20, 2024 · 3 comments

Comments

@EmosewaMC
Copy link

EmosewaMC commented Mar 20, 2024

The problem

Hi,
I have after experiencing the bug on a repo with a ton of work, that a combination of squash commits via github desktop and git rm --cached <file> results in, instead of the file just being untracked as was done in the original command, the file is deleted. This caused me to lose around 15 hours of work and I am going to just cut my losses and report this as an issue, and do the work again (at least i know what to do now, maybe it'll be faster)

Release version

Version 3.3.11 (x64)

Operating system

Windows 10

Steps to reproduce the behavior

  1. create an empty repository
  2. create a file with some text in it
  3. commit and push the file via github desktop
  4. remove the file from being tracked via git cli through the git rm --cached <file>, commit and push via github desktop
  5. ignore all files in a gitignore (just a *)
  6. squash the full repository down to 1 commit
  7. observe that the created file, instead of just being untracked, is now deleted

Log files

Will provide as needed in private.

Screenshots

No response

Additional context

May not be a bug with desktop, but when github desktop told me in reasons I cannot squash commits that are themselves squashes, that the squash replays the commits up until that point, I would assume it remembered the what and why of the commit, not just the what.

@steveward
Copy link
Member

Thanks for the detailed report and reproduction steps @EmosewaMC. I'm sorry to hear about the issues you encountered.

I got around to testing this and was unable to reproduce the behavior by following the steps you shared. I had three commits I squashed down to one, and the README.md file I had created and previously committed remained as an untracked file.

Have you been able to consistently reproduce this? Is there anything I could be missing?

@steveward steveward added the more-info-needed The submitter needs to provide more information about the issue label Apr 4, 2024
@EmosewaMC
Copy link
Author

https://www.youtube.com/watch?v=U_M_4ZkUZ4U
heres a video of the reproduction

@github-actions github-actions bot removed the more-info-needed The submitter needs to provide more information about the issue label Apr 5, 2024
@EmosewaMC
Copy link
Author

EmosewaMC commented Apr 5, 2024

now I would like to add, if I used the next commit back from the one i selected to merge with, github desktop would infinitely error on the squash and print out an error i couldnt see and I believe these are them in the logs

2024-04-05T07:36:14.438Z - error: [ui] GitError: Rebasing (1/3)
Rebasing (2/3)
error: The following untracked working tree files would be overwritten by merge:
	README.md
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     squash 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee committing
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 23a1edd... committing

2024-04-05T07:36:14.440Z - info: [ui] [squash] starting rebase for main at c3d5c2cc2eb2ea1dba7b60577d120e0453cb4472
2024-04-05T07:36:14.440Z - info: [ui] [squash] to restore the previous state if this completed rebase is unsatisfactory:
2024-04-05T07:36:14.440Z - info: [ui] [squash] - git checkout main
2024-04-05T07:36:14.440Z - info: [ui] [squash] - git reset c3d5c2cc2eb2ea1dba7b60577d120e0453cb4472 --hard
2024-04-05T07:36:14.555Z - warn: [ui] Attempted to add a popup of already existing type - MultiCommitOperation.
2024-04-05T07:36:29.202Z - info: [ui] [continueRebase] continuing rebase for 92be8b89a8f69fa3ea13693e3137401f78b08089
2024-04-05T07:36:29.331Z - warn: [ui] [rebase] no tracked changes to commit for 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee, continuing rebase but skipping this commit
2024-04-05T07:36:29.400Z - error: [ui] `git rebase --skip` exited with an unexpected code: 1.
stderr:
Rebasing (4/5)
error: The following untracked working tree files would be overwritten by merge:
	README.md
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     squash 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee committing
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 23a1edd... committing

2024-04-05T07:36:29.496Z - warn: [ui] Attempted to add a popup of already existing type - MultiCommitOperation.
2024-04-05T07:36:29.496Z - info: [ui] [continueRebase] completed rebase - got Error and on tip 92be8b89a8f69fa3ea13693e3137401f78b08089 - kind Detached
2024-04-05T07:36:30.791Z - info: [ui] [RepositoryIndicatorUpdater]: Refreshing sidebar indicators for 50 repositories took 80.0s of which 23.7s paused, total 103.7s
2024-04-05T07:36:31.224Z - info: [ui] [continueRebase] continuing rebase for 92be8b89a8f69fa3ea13693e3137401f78b08089
2024-04-05T07:36:31.349Z - warn: [ui] [rebase] no tracked changes to commit for 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee, continuing rebase but skipping this commit
2024-04-05T07:36:31.407Z - error: [ui] `git rebase --skip` exited with an unexpected code: 1.
stderr:
Rebasing (5/6)
error: The following untracked working tree files would be overwritten by merge:
	README.md
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     squash 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee committing
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 23a1edd... committing

2024-04-05T07:36:31.503Z - warn: [ui] Attempted to add a popup of already existing type - MultiCommitOperation.
2024-04-05T07:36:31.503Z - info: [ui] [continueRebase] completed rebase - got Error and on tip 92be8b89a8f69fa3ea13693e3137401f78b08089 - kind Detached
2024-04-05T07:36:32.672Z - info: [ui] [continueRebase] continuing rebase for 92be8b89a8f69fa3ea13693e3137401f78b08089
2024-04-05T07:36:32.798Z - warn: [ui] [rebase] no tracked changes to commit for 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee, continuing rebase but skipping this commit
2024-04-05T07:36:32.853Z - error: [ui] `git rebase --skip` exited with an unexpected code: 1.
stderr:
Rebasing (6/7)
error: The following untracked working tree files would be overwritten by merge:
	README.md
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     squash 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee committing
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 23a1edd... committing

2024-04-05T07:36:32.957Z - warn: [ui] Attempted to add a popup of already existing type - MultiCommitOperation.
2024-04-05T07:36:32.957Z - info: [ui] [continueRebase] completed rebase - got Error and on tip 92be8b89a8f69fa3ea13693e3137401f78b08089 - kind Detached
2024-04-05T07:36:34.206Z - info: [ui] [continueRebase] continuing rebase for 92be8b89a8f69fa3ea13693e3137401f78b08089
2024-04-05T07:36:34.332Z - warn: [ui] [rebase] no tracked changes to commit for 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee, continuing rebase but skipping this commit
2024-04-05T07:36:34.388Z - error: [ui] `git rebase --skip` exited with an unexpected code: 1.
stderr:
Rebasing (7/8)
error: The following untracked working tree files would be overwritten by merge:
	README.md
Please move or remove them before you merge.
Aborting
hint: Could not execute the todo command
hint: 
hint:     squash 23a1edd5019e79b73baed38d6cb4a588fc6ca9ee committing
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue
Could not apply 23a1edd... committing

this is on version 3.3.12 fwiw

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

2 participants