Skip to content

Instantly share code, notes, and snippets.

@AlexGalhardo
Forked from lmcneel/remove-node-modules.md
Created December 26, 2022 23:13
Show Gist options
  • Save AlexGalhardo/f49bc9ea14fae8bb78a71ed4c4bf16a9 to your computer and use it in GitHub Desktop.
Save AlexGalhardo/f49bc9ea14fae8bb78a71ed4c4bf16a9 to your computer and use it in GitHub Desktop.

Revisions

  1. @lmcneel lmcneel revised this gist Dec 15, 2021. 1 changed file with 35 additions and 15 deletions.
    50 changes: 35 additions & 15 deletions remove-node-modules.md
    Original file line number Diff line number Diff line change
    @@ -1,33 +1,53 @@
    # How to remove node_modules

    1. Create a .gitignore file in the git repository if it does not contain one
    ## Create a `.gitignore` file

    `touch .gitignore`
    1. Check for an existing `.gitignore` file in the project directory

    2. Open up the .gitignore and add the following line to the file
    ```Bash
    ls -a
    ```

    `**/node_modules`
    2. If your project directory has a `.gitingore` file - skip to step 3. Otherwise, continue with:

    3. Remove the node_modules folder from the git repository
    Create a `.gitignore` file in the git repository

    `git rm -r --cached node_modules`
    ```Bash
    touch .gitignore
    ```

    4. Commit the git repository without the node modules folder
    ## Remove the `node_modules` directory

    `git commit -m "Removed node_module folder"`
    3. Open up the `.gitignore` and add the following line to the file

    5. Push the repository to github
    ```
    **/node_modules
    ```

    `git push origin master`
    4. Remove the `node_modules` folder from the git repository


    After all of that, you should also add the gitignore and commit it to the repository
    ```Bash
    git rm -r --cached node_modules
    ```

    ## Commit All Changes

    `git add .gitignore`
    5. Commit the git repository without the `node_modules` folder

    ```Bash
    git commit -m "Removed node_modules folder"
    ```

    `git commit -m "Updated the .gitignore file`
    6. Push the change to the remote repo

    ```
    git push origin main
    ```

    7. Commit the `.gitignore` file

    `git push origin master`
    ```Bash
    git add .gitignore
    git commit -m "Updated the .gitignore file"
    git push origin main
    ```
  2. @lmcneel lmcneel revised this gist Sep 13, 2020. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion remove-node-modules.md
    Original file line number Diff line number Diff line change
    @@ -3,23 +3,31 @@
    1. Create a .gitignore file in the git repository if it does not contain one

    `touch .gitignore`

    2. Open up the .gitignore and add the following line to the file

    node_modules
    `**/node_modules`

    3. Remove the node_modules folder from the git repository

    `git rm -r --cached node_modules`

    4. Commit the git repository without the node modules folder

    `git commit -m "Removed node_module folder"`

    5. Push the repository to github

    `git push origin master`


    After all of that, you should also add the gitignore and commit it to the repository


    `git add .gitignore`


    `git commit -m "Updated the .gitignore file`


    `git push origin master`
  3. @lmcneel lmcneel revised this gist Feb 5, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions remove-node-modules.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,19 @@
    # How to remove node_modules

    1. Create a .gitignore file in the git repository if it does not contain one

    `touch .gitignore`
    2. Open up the .gitignore and add the following line to the file

    node_modules
    3. Remove the node_modules folder from the git repository

    `git rm -r --cached node_modules`
    4. Commit the git repository without the node modules folder

    `git commit -m "Removed node_module folder"`
    5. Push the repository to github

    `git push origin master`

    After all of that, you should also add the gitignore and commit it to the repository
  4. @lmcneel lmcneel revised this gist Feb 5, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions remove-node-modules.md
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,7 @@
    After all of that, you should also add the gitignore and commit it to the repository

    `git add .gitignore`

    `git commit -m "Updated the .gitignore file`

    `git push origin master`
  5. @lmcneel lmcneel created this gist Feb 5, 2017.
    18 changes: 18 additions & 0 deletions remove-node-modules.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # How to remove node_modules

    1. Create a .gitignore file in the git repository if it does not contain one
    `touch .gitignore`
    2. Open up the .gitignore and add the following line to the file
    node_modules
    3. Remove the node_modules folder from the git repository
    `git rm -r --cached node_modules`
    4. Commit the git repository without the node modules folder
    `git commit -m "Removed node_module folder"`
    5. Push the repository to github
    `git push origin master`

    After all of that, you should also add the gitignore and commit it to the repository

    `git add .gitignore`
    `git commit -m "Updated the .gitignore file`
    `git push origin master`