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: Can't rebase continue or commit without modified files #60149

Closed
joaomoreno opened this issue Oct 8, 2018 · 18 comments · Fixed by #156410
Closed

Git: Can't rebase continue or commit without modified files #60149

joaomoreno opened this issue Oct 8, 2018 · 18 comments · Fixed by #156410
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@joaomoreno
Copy link
Member

From @schollii

  1. While a branch is checked out, I do a git rebase master from command line (bash on ubuntu), and git hits a conflict.
  2. I then go to the vs code window where the folder is open. In the Git panel on the left, I can see the file listed under Merge with a C as status, and I can see there are conflict markers in the file.
  3. I resolve each conflict and save.
  4. The file status changes to M once all conflicts resolved.
  5. Then I can click the plus sign on the file, and the file disappears from the Merge (perhaps a commit occurs then?). But a rebase continuation does not happen, there is nothing under Commit, and there is no option to do rebase continue.
@joaomoreno joaomoreno added this to the Backlog milestone Oct 8, 2018
@joaomoreno joaomoreno self-assigned this Oct 8, 2018
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities git GIT issues labels Oct 8, 2018
@skprabhanjan
Copy link
Contributor

@joaomoreno , can i work on this? :)

@joaomoreno joaomoreno changed the title Git: Can't rebase continue without modified files Git: Can't rebase continue or commit without modified files Oct 9, 2018
@matteobosc
Copy link

@joaomoreno thank you for referencing my issue, I'm going to subscribe to this thread :)

@skprabhanjan
Copy link
Contributor

skprabhanjan commented Oct 10, 2018

@joaomoreno , few points to just clear things
I tried reproducing this taking the comments into consideration.( referring to all 3 issues that were opened before)

  1. git rebase master did throw an error in the bash saying merge conflict
  2. Went to the file and resolved the conflicts
  3. Clicked on the "+" sign to stage the changes and it did disappear from the "Merge Changes" and came under "Staged Changes" (This did not run the commit )
  4. Entered the commit message and committed the changes.

Until this point git rebase --continue was not run even though the rebase was in progress (Referring to #6614 (comment)).
Attaching the git log file for these operations. log.txt

So after the 4th point is when the git rebase --continue command should run?

Please clarify if I am in the correct path :)
Thanks!

@matteobosc
Copy link

@skprabhanjan referring to the issue I've opened yesterday (#60275 ), the steps are a bit different. When I accept the current changes (so the file is identical to the version of the last commit) and I click on "+" sign the file disappears from "Merge Changes" but doesn't appear under "Staged Changes".

Hope you find this useful, thanks in advance

@skprabhanjan
Copy link
Contributor

@matteobosc , I understand your point that the steps are different but I guess all these will be fixed under the same issue
@joaomoreno should confirm upon this :)

@joaomoreno
Copy link
Member Author

Clicked on the "+" sign to stage the changes and it did disappear from the "Merge Changes" and came under "Staged Changes" (This did not run the commit )

You gotta resolve the changes by taking all changes from one side, in order for the file not to end up in the Staged Changes at all.

@skprabhanjan
Copy link
Contributor

@joaomoreno , I will try understanding this more deeply.
Will get back to you in case on any doubts :)
Thanks!

@skprabhanjan
Copy link
Contributor

@joaomoreno
Copy link
Member Author

Well, no... the staging it correct. Staging those files will end up in a no-op. The problem is that you can't commit in VS Code without changes, although you'd want to continue the rebase/merge in this case. I will remove the help wanted label as this seems to be an advanced issue.

@joaomoreno joaomoreno removed the help wanted Issues identified as good community contribution opportunities label Oct 15, 2018
@dmstern
Copy link

dmstern commented Jan 28, 2020

I run into this issue several times. If I try to continue the rebase via terminal, it tells the following:

git rebase --continue
Applying: original commit message here
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

If there are other changes than the conflicted files, VSCode can continue the rebase by just clicking commit. Here that doesn't work.

The line that helped me was the following from the error log above:

You can instead skip this commit: run "git rebase --skip".

My workaround:

  • add the resolved conflicting files by clicking the +
  • run git rebase --skip in the terminal

Suggestion:
So maybe a solution could be (analog to the rebase behavior) to tell VSCode to run git rebase --skip if there are no staged files in rebase in progress state when the user clicks commit.

@kczx3
Copy link

kczx3 commented Aug 26, 2020

I run into this from time to time as well. Just this last time, I had to git rebase --skip all the commits locally. Then I click the button to pull/push to my remote which then introduced the same merge conflicts that I had during my first --skip locally. Resolved those and committed. Then my pull/push commit counts changed from 3/22 to 0/23. Clicked the button again to push all 23 back up to my remote. Very confusing process though.

@balonik
Copy link

balonik commented Mar 5, 2021

I know this is quite old, but currently when I hit this scenario and click the commit icon vscode asks me if I want to do an empty commit and if I confirm the rebase process continues.

@joaomoreno joaomoreno assigned eamodio and unassigned joaomoreno Mar 8, 2021
@Woodz
Copy link

Woodz commented Jul 29, 2021

I know this is quite old, but currently when I hit this scenario and click the commit icon vscode asks me if I want to do an empty commit and if I confirm the rebase process continues.

This only works if you have configured VS Code to allow empty commits

@lszomoru lszomoru assigned lszomoru and unassigned eamodio Oct 4, 2021
@reloxx13
Copy link

i still cannot continue the rebase wiht ui cause of empty commit. the old FR #6614 took 2 years, how long will it be this time

@dkyeremeh
Copy link

dkyeremeh commented Nov 25, 2021

@skprabhanjan
I encountered the same issue yesterday. This issue occurs primarily because vs code ui does not have an option that triggers git rebase --skip during rebase.

Explanation

When the user applies the current changes and saves during a rebase conflict, the file disappears from the staged area because there's no changes to commit. When the user then clicks the commit button, the app runs git rebase --continue in the background. If empty commits are not enabled, this triggers the error described by @joaomoreno.

Running git rebase --skip as @kczx3 pointed out works.

To solve this, a skip button can be displayed next to the commit button during rebase. The skip button can also be used to trigger a skip when the user thinks the commit is no longer necessary. An abort button might also be helpful for those who are not familiar with cli so they can abort the rebase

@gautam-borkar
Copy link

@skprabhanjan I encountered this issue while pulling the changes from the upstream.

Explanation

  • Did a git pull of upstream to master.
  • Encounter a conflict
  • Accepted all the current changes
  • Clicked on + sign for staging changes
  • File disappears

@lszomoru lszomoru modified the milestones: Backlog, August 2022 Jul 21, 2022
@lszomoru lszomoru modified the milestones: August 2022, July 2022 Jul 27, 2022
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Jul 27, 2022
@lszomoru
Copy link
Member

Steps to verify:

  • Launch VS Code Insiders (2022-07-28 or later)
  • Open a folder/workspace that contains a git repository
  • Create a topic branch (ex: rebase-test)
  • Switch back to the main branch, make a change in a file, and commit
  • Switch to the topic branch, modify the same line in the same file, and commit
  • From the command palette execute the Git: Rebase Branch... command and choose the main branch
    • Confirm that you get a notification that there is a conflict that you have to resolve
  • Resolve the conflict by accepting all changes from the main branch
  • After resolving the conflict, save the file, and click on the + action to stage the change
    • Confirm that the file does not appear any more in the "Source Control" view
  • Click on the "Continue" action button
    • Confirm that the rebase operation completes

@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 28, 2022
@reloxx13
Copy link

4 years later

@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Jul 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.