How do I make my hubspot mirror the github?

I just setup Github Actions on a hubspot project that has been working without it. But, before I setup Github I moved files into folders on my local version. Now all the modules are organized, but when pushing to hubspot it shows the organized folders next to all the components as they were before. How do I make it recognize the modules in the folders as the ones I want to use so I can delete the others? And how can I make sure hubspot responds to file name/folder changes that happen on git in the future?

What CLI command are you running to upload the files into HubSpot? If you are running ‘watch’ (which is what I use 99% of the time), then you can add ‘--remove’ to the end and when you delete files from your local environment, it will delete them in real time from HubSpot. Your command would look something like ‘hs watch --account=[name] [src] [dest] --remove’. This also does the same for moving files around into different folders. It essentially deletes the old and creates a new one in the new destination. It should also update any files that reference the moved file to show the new path. I always double check this though to make sure.

This may be tedious, but my recommendation would be to start over. Move all the files into your local environment as they were before, turn on hs watch, then re-organize them so the watch catches all the changes.

I’m talking about the Github upload though - I’m using the watch for my dev account. Do you know if there’s a way to do something like --remove with Github Actions or full upload?

Also, when you say files will be updated to the new path, will the pages that use them also be unbroken and contain the same module and content?

I tried exactly what you said (I didn’t even move a file, just renamed it), and the link to the page was broken. The live pages using the module were immediately broken, and I’m not sure how to get it back (I know, I should have tried it on an unimportant page first). Any idea what I did wrong?

Edit: Now that I restored the file, when I go into the page editor I can see the component added back, but each page has to be manually republished for it to be fixed. Unfortunately I don’t have a list of all the pages using that component

I’m sorry that happened, a couple things here: First, I never rename modules in my local environment. I always rename in hubspot design manager then pull it to local, and delete the old (there would be two modules at that point). They are always a little finicky renaming in cli. Second, I apologize but without know knowing exactly how the files and code are setup, I couldn’t tell you exactly where it went wrong. Lastly, if you go into the design manager, you should be able to right click on a module and ‘show dependents’. That will give you a list of all templates and pages that are using it. You should be able to find all the live pages with it that way to republish them.

Side note: You mentioned that ‘you should have tried it on an unimportant page’. Anytime I am making changes to a module that is used on a live page, I always clone the module to make a test version. If you add that to a testing page, you can use it to see exactly what will happen on the page when you push the changes live. That way you know what’s coming when you change the original module.

Thanks for your reply! It’s really ashame hubspot hasn’t fixed this local development issue. Even though it seems like they use github themselves internally?

> Second, I apologize but without know knowing exactly how the files and code are setup, I couldn’t tell you exactly where it went wrong

Yeah, I didn’t expect you to - was just expressing my annoyance with this. I currently have all my local modules, which are organized, as organized folders in hubspot that are ignored, as hubspot is still looking at the unorganized modules to use in pages.

> Lastly, if you go into the design manager, you should be able to right click on a module and ‘show dependents’.

That’s my problem - the pages no longer show up as dependents, even after un-renaming and restoring the module. If I go to edit the page, it’ll show up, and if I republish the page it’ll be fixed - but I can’t even see all the pages to edit because the “dependent” link was broken. (I’ve fixed the important ones by now, so my bigger concern is figuring out how to move these modules. I have organized modules in local, and I need hubspot to consider these the source of truth. In some places, I’ve also edited or renamed the organized modules.)

Re the side note: Yeah I’ve been doing that when developing - but this is a case where it seems I have to work directly on prod. But I should’ve found an unimportant module to test first. Instead I tried renaming (vs. moving) to test first