node_modules when testing different dependencies in different branches - node-modules

When I have different dependencies in different branches, the node_modules folder gets messy. I usually rename the folder for the specific branch and include that folder to the .gitignore in other branches.
what's the best way to manage the node_modules folder?

Related

Prevent yarn from creating node_modules in monorepo root

I'm using yarn with monorepos that contain several packages. For examples packages foo and bar might be located in repo/foo and repo/bar within the monorepo root repo. The problem is that I sometimes accidentally run yarn without parameters in the repository root instead of the packages directories. This creates a repo/node_modules directory and a repo/yarn.lock file. Can I somehow prevent yarn from creating node_modules and yarn.lock in the repository root directory?

my laravel seeds folders ignored by git how to resolve and avoid

i have modules folders in my Laravel Project.
and my sub packages/projects in there
my Laravel parent project use them to working
modules folder gitignored by his main project.
those projects in modules folders connect to its own git repos.
those projects have seeds and factories folder need when i run composer install in the parent.
but seeds and factories are empty and not sync with git and when other developers fetch/clone the repos the parent project need them.
how can i add files as Laravel documentation there to avoide this action.
is it true to create a text file there?
Git doesn't commit empty folders. Usual solution is to add .gitkeep as empty text file.

Laravel Email Templates on Production Server

On my local development server I have changed the default email templates, however, once I have pushed to the production server I notice that those changes don't push because the vendor folder is included in the gitignore file.
What is the best way to get my local changes moved to the production server? I have already published the files on the production server, but how would I access those files to make the changes?
Thank you!
You can safely commit contents of the vendor directory inside resources/views. If no .gitignore is present in the resources/views directory, add one with the content !/vendor. This will unignore the vendor directory within this path.
Side note:
I guess you have vendor/ written in the .gitignore of your projects root directory. This is a special syntax that will use inheritance across your project, meaning the vendor directory is not only ignored in the root directory, but also all sub directories. In theory, if you change the entry to /vendor, the other vendor directory within resources/views should be unignored automatically without an extra .gitignore. But be careful to not unignore other unwanted vendor directories...

Is it possible to include .git folder

I want to put my setting files in to the Git repository so I can sync them between my computers. I have the following folder structure:
d:\settings\
.git
plugins\
.git
other_things\
So, settings and plugins are separate git repositories. To track plugins folder without using submodules, I run the following command as per this post:
git add plugins/
Everything was fine, I was able to 'see' the files from plugins folder within settings up until I tried to sync it to my other computer, where plugins folder was missing its own .git directory.
Is it possible to include (exclude from .gitignore) .git folder via .gitignore somehow? I tried to use something like:
!..\.git
but it didn't work.
Thanks.
You should use submodule or subtree for that purpose. You can read more about submodules here:
http://git-scm.com/docs/git-submodule

Changed folder structure in Xcode Project not reflected in Git Repository

I have an Xcode project that is under version control. I've grouped the classes in the project navigator into folders based on what the classes do (eg. Models, Views, Controllers, etc.). However, these folder structures seem local to my machine and it is not reflected in my own local git repository, or if I do a git pull from another machine, the folders that I've created or organized my classes into don't appear. So, How do you get the changes you make (organizing the classes into folders) to reflect in your local and remote repository?
Try this
# modified, new and deleted files
git add -A
ref
I found that the adding a folder or directory manually inside the local repository to work for me. Create the folder in the repository,git add folder_name/ to actually track and add it to the repo. The files then can be moved into this folder. Depending on how you move it, you may need to do git rm <file_name> and git add </folder_name/file_name>.

Resources