Tips and Tricks for Git

Git Submodules

// 1. Add submodule to a new repo
git submodule add https://github.com/chaconinc/DbConnector
// 2. Updating repo with new submodule
git pull
git submodule update --init --recursive
// 2. Or Cloning repo with new submodule
git clone --recurse-submodules https://github.com/chaconinc/MainProject
// 3. Pulling repo with submodules
git pull --recurse-submodules

by git

Delete branch locally and remotely

// 1. locally
git branch -d localBranchName
// 2. remote
git push origin :remoteBranchName

by FreeCodeCamp

Apply .gitignore to committed files

// Edit your .gitignore with the file to ignore and run
git rm --cached /path/to/file

by SO

Git ignore file mode (chmod) changes

// Only current repo
git config core.fileMode false
// General
git config --global core.fileMode false

by SO