Welcome to StackOverflow!
Maybe Git is not the best solution for this, I will advise you use a bash/Powershell script to trigger npm update across all the sites. But if you really want to do it with Git, below you will get an option.
Step 0: Clone the site you want to take as a base for all the others in your local computer
Step 1: Create Git remotes required on your local computer. This are the urls/pointers to the different sites you need to push and pull**
# Syntax - git remote add <remote_name> <remote_url>
> git remote add site1 https://github.com/user/repo1.git
> git remote add site2 https://github.com/user/repo2.git
Step 2: Add to .gitignore file the files/folders that you don't want to change across sites
> cat .gitignore
/src/pages/posts
/gatsby-config.js
**Step 3: Now every time you make changes to these packages you can, push to all the remotes master branch with the following command
git remote | xargs -L1 -I R git push R master
Note: With this solution when you pull an update to your other sites, you need to modify the .gitignore file deleting the entries you made. Otherwise you sites will start ignoring those folders too.
Reference of this third step: https://stackoverflow.com/a/18674313/10783334