Git plugin - "Cannot pull with rebase because of the following uncommitted files"
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Git plugin - "Cannot pull with rebase because of the following uncommitted files"
Post by chrispitude »
Hi all,
We are heavily using the Git plugin in Oxygen. We've switched from merge pulls to rebase pulls to simplify the commit graph, and it's been great! The only wrinkle is that sometimes users get an error:
1. If I have (A) an uncommitted file and (B) there's an unpulled commit, the rebase pull succeeds if I pull (B) first:
The error can be avoided if you can remind writers to always pull before committing. However, not everyone will remember to do that.
I'm guessing this occurs because the presence of the local unpushed commit causes Git not to be able to do a simple fast-forward of the head commit. Research suggests that the normal way to handle this is to do a stash-pull-unstash. There's even an "autostash" feature to make this easier. However, we don't have access to those features in the Git plugin.
We are heavily using the Git plugin in Oxygen. We've switched from merge pulls to rebase pulls to simplify the commit graph, and it's been great! The only wrinkle is that sometimes users get an error:
But it didn't always happen when uncommitted files were present, so I did some experiments to figure it out.Cannot pull with rebase because of the following uncommitted files:
1. If I have (A) an uncommitted file and (B) there's an unpulled commit, the rebase pull succeeds if I pull (B) first:
git-rebase-pull-before-commit.gif
2. If I have (A) an uncommitted file and (B) there's an unpulled commit, the rebase pull succeeds if I commit (A) first:git-rebase-pull-after-commit.gif
3. If I have (A) an uncommitted file and (B) there's an unpulled commit and (C) there's an unpushed commit, the rebase pull succeeds if I push (A) first:git-rebase-pull-after-commit-existing-commit.gif
So it's the combination of (A), (B), and (C) that cause the problem.The error can be avoided if you can remind writers to always pull before committing. However, not everyone will remember to do that.
I'm guessing this occurs because the presence of the local unpushed commit causes Git not to be able to do a simple fast-forward of the head commit. Research suggests that the normal way to handle this is to do a stash-pull-unstash. There's even an "autostash" feature to make this easier. However, we don't have access to those features in the Git plugin.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Git plugin - "Cannot pull with rebase because of the following uncommitted files"
Post by chrispitude »
The following Git plugin enhancement should avoid this scenario:
https://github.com/oxygenxml/oxygen-git ... /issues/98
https://github.com/oxygenxml/oxygen-git ... /issues/98
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: Git plugin - "Cannot pull with rebase because of the following uncommitted files"
Post by sorin_carbunaru »
Hello Chris,
According to the JavaDoc from the JGit developers, this scenario happens when "the repository contains uncommitted changes and the rebase is not fast-forward".
Based on some old experiments of mine, an example of this happening is when we have local changes in files X and Y, and there's also an incoming change from remote on X. At this moment, we choose to commit X and try to pull with rebase, still having Y locally modified.
The issue you mentioned has already been tackled. We added an option (a check box) to allow notifying the user when new commits pushed to the remote repository are detected.
You could try this feature by cloning the Git repository from https://github.com/oxygenxml/oxygen-git-plugin on your PC and build the project locally using Maven. Unzip the resulted JAR inside {oXygenInstallDir}/plugins. Make sure you don't create any intermediate folders. After unzipping the archive, the file system should look like this: {oXygenInstallDir}/plugins/git.support-x.y.z, and inside this folder, there should be a plugin.xml file. After doing this, start Oxygen and look for the Plugin > Git Client preferences page and activate the option.
Regards,
Sorin Carbunaru
Oxygen XML Editor
According to the JavaDoc from the JGit developers, this scenario happens when "the repository contains uncommitted changes and the rebase is not fast-forward".
Based on some old experiments of mine, an example of this happening is when we have local changes in files X and Y, and there's also an incoming change from remote on X. At this moment, we choose to commit X and try to pull with rebase, still having Y locally modified.
The issue you mentioned has already been tackled. We added an option (a check box) to allow notifying the user when new commits pushed to the remote repository are detected.
You could try this feature by cloning the Git repository from https://github.com/oxygenxml/oxygen-git-plugin on your PC and build the project locally using Maven. Unzip the resulted JAR inside {oXygenInstallDir}/plugins. Make sure you don't create any intermediate folders. After unzipping the archive, the file system should look like this: {oXygenInstallDir}/plugins/git.support-x.y.z, and inside this folder, there should be a plugin.xml file. After doing this, start Oxygen and look for the Plugin > Git Client preferences page and activate the option.
Regards,
Sorin Carbunaru
Oxygen XML Editor
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Git plugin - "Cannot pull with rebase because of the following uncommitted files"
Post by chrispitude »
Hi Sorin,
The troublesome thing about this for us is that they don't have to be the same file. The remote commit can be any file, even a file that isn't being worked on locally; it's not just conflict cases. I am surprised the rebase behavior is this limiting, to be honest.
I'll try building the plugin and report back, thank you! I appreciate the extra detail you gave on how to do it, as all of it is new to me and I would no doubt struggle without your guidance.
The troublesome thing about this for us is that they don't have to be the same file. The remote commit can be any file, even a file that isn't being worked on locally; it's not just conflict cases. I am surprised the rebase behavior is this limiting, to be honest.
I'll try building the plugin and report back, thank you! I appreciate the extra detail you gave on how to do it, as all of it is new to me and I would no doubt struggle without your guidance.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service