Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Staging in shared submodule deletes file

Horschig
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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
loom essentials certification, loom training, get certified in loom, atlassian certification, loom async video, video messaging skills, atlassian learning, loom for teams, online certification, loom badge, loom for business, atlassian education

Get Certified in Loom! 🧑‍🎓

Time to up your Loom game! The new Loom Essentials Certification is here! Show off your skills, learn pro tips, and get officially recognized. Perfect for taking your video messaging to the next level.

Learn more
AUG Leaders

Atlassian Community Events