Linux Git command
git config --global user.name "example"
git config --global user.email "
[email protected]"
git config --global core.editor emacs
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
git config --global --list
add alias gs='git status' in .bashrc
Two ways to get a repository
Clone someone else's - git clone
Make your own - git init
git add *.c (add all C source files in the current folder)
git add \*.c (add all C source files in the current folder and all subfolders)
git add . (add everything, be careful)
git commit -a
git commit -m <comment>
git commit --amend
git rm <file> ---- removes <file> from Git and deletes it as well
git rm --cached <file> leaves it hanging in the directory, it's just gone from git
git mv <src> <dst>
git log
git log <path>
git diff
git diff --cached
edit .gitignore --- the files you don't want to save
git branch --- inspect the branches
git checkout branch_a --- switch to branch a
git checkout -b branch_b --- create branch b and switch to b
git merge branch_a
git mergetool
---