Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Staging in shared submodule deletes file


I set up a shared submodule, and whenever I stage a file in Sourcetree it shows that all files contents are deleted, so effectively Sourcetree states that I am staging a deleted file. When I unstage, the file is deleted. When I add the file via the terminal, it all works flawlessly. I think the tricky thing here is the shared submodule part, with which Sourcetree has trouble. While it could be that I am doing something wrong, I have the belief that Sourcetree is doing more than a simple 'git add' (as that works from the command line).

I set up the shared submodule as followed:

1. Clone the project that should serve as the shared submodule locally to some directory
2. In the shared submodule, modify the local config of this project by adding 'worktree = ..' under [core]

For all projects sharing this submodule:

3. Add the submodule (this means, effectively I now have two checked out copies of that project)
4. Delete the respective submodule folder in ./git/submodule/
5. Delete the content of the submodule directory apart from the .git file
6. Modify the .git in the submodule directory to point to the path of the project setup in 1)


1 answer

0 votes
minnsey Atlassian Team Apr 08, 2019


I think you summary is probably correct, we certainly don't test such a shared submodule setup.

Can I ask why you do it like this rather than having the submodule available via a remote and each parent project simply adding it as a standard submodule from that remote? 

Sure, that is because I do not want to have several different copies checked out. This facilitates working across projects. If I'd use the standard way, if I change a file in a submodule in one project, the file would not be changed in the respective submodule in all other projects. I would have to commit it first, and then pull in all my other projects. With a shared submodule, I change a file in one project, and the changes are 'automatically' applied to all projects sharing this same submodule.


I see that I posted this under questions, but I forgot to ask one. So here it is: Given my setup above and the problem I run into, is this a bug in Sourcetree?

minnsey Atlassian Team Apr 09, 2019

Possibly ;) Could you raise a ticket at Thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

78,819 views 134 29
Read article

Atlassian Community Events