gitbutler
gitbutler copied to clipboard
Support repositories with submodules in them
Any status on when this will be added? Love GitButler but using submodules in all my projects
Same, not working
Any idea why GitButler is currently unable to support submodules?
See #2891. This issue disallowed opening repos with submodules due to a bug that would mess up the submodule.
This issue also seems to be a duplicate of #2541. Which mentions that submodule support is on the list.
Same issue here. All of my personal projects plus the public projects I contribute to contain submodules.
Waiting for this feature, submodules are heavily utilized in my repos.
In all cases, GitButler should not rejecting a repository if it has submodules. It should just ignore submodules and work if there were no submodules.
I don't care about changes in the sub modules, I just want to work on the main repository using git butler!
It is even OK if git bulter removes all files in the sub modules - https://github.com/gitbutlerapp/gitbutler/issues/2891#issuecomment-1963020585
Even as an initial pass, it would be helpful if users could scope to a submodule and only make commits within that one submodule.
I work in submodules every day, so having this feature would be huge (and essential) to my use of git butler.
In my use case, deleting files from a submodule would be problematic, so the outright rejection is much better than the alternative of damaging the repository or database. Much appreciated.
There at least should be an option to override this behaviour, accepting any risk it might have so that we can just work with the submodule. It might be a screen we need to accept, a config we need to change somewhere. Is there an option like this?
@limonkufu
There at least should be an option to override this behaviour, accepting any risk it might have so that we can just work with the submodule. It might be a screen we need to accept, a config we need to change somewhere. Is there an option like this?
Sort of. GitButler only appears to check for submodules when adding a repo, and it does so by checking for a .gitmodules file in the root of the repo.
Thus, if you rm .gitmodules and then add the repo, it will let you. And then you can just restore that file with git checkout .gitmodules (and GitButler will be none the wiser).
[!warning] You are on your own here. I have no idea how GitButler messes up submodules. My assumption is that you should avoid touching submodules and submodule code entirely when using GitButler, but even that might be unsafe. Test how it works in a test repo. Don't yell at me if this goes wrong.
For everyone else who finds this from Google, you may not realize this is an issue because the error is hidden when clicking:
Thanks for sharing! Please note that this is a regression in the latest stable release (Version 0.11.4 (20240423.110032), and it's fixed in nightly.
@markjaquith thanks, I am willing to take the risk and my usecase is just read only submodules. If you want me to test something specific I can have a look at that as well as your tester?
I tried everything but it still gives me the same error.
I tried everything described here: https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule
rm .gitmodulesgit submodule deinitgit rm <submodule>rm <submodule>rm .git/module
Could you advise how I can make it work by deleting an existing submodule? I didn't commit any of the changes though
Can you share the errors you see? When adding a project, it essentially only looks at .gitmodules and if present, rejects the repository. In a way, it would be unexpected if it would still think submodules are present without .gitmodules.
yeah sure.
I don't have any .gitmodules in the repo.
ls -all .gitmodules
ls: cannot access '.gitmodules': No such file or directory
Then, I try opening the repository with Gitbutler by using "Add new project" button. I get the following in console:
[Error] ipc->add_project: {"path":"/Users/u.yilmaz/dev/ska-cicd-automation"} (2)
Error: Repositories with git submodules are not supported
{code: "errors.projects", message: "Repositories with git submodules are not supported"}
(anonymous function) (user.3f3fe2e4.js:4:240)
(anonymous function) (ipc.21fc29f2.js:1:2241)
Do you still have it in the index? If that's the case, git checkout .gitmodules work work despite ls .gitmodules failing. If that's the case, now GitButler is smart enough to get the .gitmodules file from the index, which is also what Git does I believe. This can be put to the test of course, but git submodule should list something.
ah okay that was it. I didn't think removing from the index was also needed. Thanks 👍
Would it be unreasonable to change this from an error to a warning and prompt to "Continue at your own risk" (or whatever the risk actually is?)
Or perhaps cross-linking this issue or discussion to up-doot for support.
I would second @ericclemmons suggestion.
I think previously there was data-loss when the code operated on Git indices with submodules, hence it was quickly forbidden entirely. However, I also see why submodule support is important and made sure it's on a ping on the radar of the devs.
Would it be unreasonable to change this from an error to a warning and prompt to "Continue at your own risk" (or whatever the risk actually is?)
Or perhaps cross-linking this issue or discussion to up-doot for support.
This is a very good point. A dirty "hack" you could do is to remove the .gitmodules file only while adding the repo (and then re-adding it). The app already tries to ignore submodules in it's normal operation but there is some condition under which it doesn't handle it correctly, and I havent discovered yet what that conditions is
Just installed Gitbutler so this is my 5 minute experience with it.
- Connect Github 👍
- Add a local Repo - "Gitbutler isnt supporting submodules" 👎
Removing the .gitmodules didnt solve the issue.
That was a very frustrating onboarding. I feel like submodules are essential & since almost all my repos have some sort of submodules I wont even bother trying Gitbutler for now, which is a huge shame
Hello! The latest release 0.12.6 now allows adding of repos with submodules. Here is a full changelog entry for that version - https://discord.com/channels/1060193121130000425/1183737922785116161/1255135073242583122
Let me know how it works for you! Feel free to ping me here or on discord.
@phifuh (and everybody else) - i am sorry for the shitty onboarding. I hope it works correctly for you now in the new release
the shitty onboarding.
🤣
It's pre-1.0 I'm sure most of us understand that this is a work-in-progress and are just excited and grateful to see all this work being performed out in the open <3
Okay, I was able to add https://github.com/pop-os/cosmic-epoch to GitButler in 0.12.6, and I just bumped all the submodules locally
nu ❯ git status
## gitbutler/integration
M cosmic-applets
M cosmic-applibrary
M cosmic-bg
M cosmic-comp
M cosmic-edit
M cosmic-files
M cosmic-greeter
M cosmic-icons
M cosmic-launcher
M cosmic-notifications
M cosmic-osd
M cosmic-panel
M cosmic-randr
M cosmic-screenshot
M cosmic-session
M cosmic-settings
M cosmic-settings-daemon
M cosmic-store
M cosmic-term
M cosmic-workspaces-epoch
M xdg-desktop-portal-cosmic
But GitButler doesn't display or seem to detect this as a change that needs to be branched / committed, it just has the "you are up to date" message
Then I made a change to a non-submodule file, which GitButler does detect properly, but it still doesn't offer to version those submodule reference changes
So it does indeed load the repository and function with non-submodule changes now, yay
That's great to hear!
I also think that's the expected behaviour, as it ignores all submodule changes outright.
It is working as expected. The submodules are ignored.
Okay, at this point I will close this issue as completed. Thank you all for your patience with us. If you come across any issues related to submodules or anything else, GitHub issues are very much welcome and appreciated! (or pinging us on discord)