git

Handy Git Commands:

cat .git/config

git config --list
git config --global push.default simple
git config --global color.ui true

git log
git log -n 1 (–author, –grep)

git remote -v
git remote show origin

git push --set-upstream origin master
git push --all

git branch --all
git branch -v -a
git branch -v || -vv (very verbose includes branch names)
git branch -v -a || -vv (very verbose includes branch names)
git branch --set-upstream-to

git branch -m master main
git checkout -b <newbranchname>

git reset --hard HEAD
git diff br1...br2  ## no spaces by req'ed 3 periods

# Switches:
-u - sets upstream tracking
-b - creates new branch

.gitignore

The .gitignore file can be used to tell which files and folders git should not track.

nano .gitignore

One of the best practices for using git, is to not store any sensitive information such as login credentials. It is possible to go back and remove them from a git repo but it is best to just not store them there in the first place.

Resources: