Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Staging in shared submodule deletes file

Horschig April 1, 2019

Heyho,

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
Atlassian Team members are employees working across the company in a wide variety of roles.
April 8, 2019

Hi

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? 

Horschig April 8, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2019

Possibly ;) Could you raise a ticket at https://jira.atlassian.com? Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events