Git Notes

1. History

  • To review a previous commit:

    1. Make a copy of the repo

    2. Launch gitbash

    3. CD into the copy of the repo

    4. Look through the history and identify the desired commit-hash by running:

      git log
    5. Now checkout the desired version:

      git checkout <commit-hash>

2. Troubleshooting

2.1. The .gitignore file doesn’t ignore all the files

  • Try this as an example where all the file in the node_modules folder are not being ignored:

    1. Run this

      git rm -r --cached ./node_modules
    2. Now do a git commit which will remove all of the files in node_modules folder from the list of changed files.

    3. At this point the list of changed files will be the intended list.