Simple cheatsheet
- If clone
$ git clone [url]
- Initialize directory
$ git init
- Add files
$ git add .
will add current directory - To commit use
$ git commit -m"[commit message]"
- Add and commit
$ git commit -am "[commit message]"
- Show remote -details
$git remote -v
Example : Ignore .DS_Store
, .vscode
and vendor
globally
- Create global gitignore somewhere eg:
~/.gitignore_global
- Insert ignored pattern in that file
- Set git to globally use the file
$ touch ~/.gitignore_global
$ echo .DS_Store >> ~/.gitignore_global
$ echo .vscode >> ~/.gitignore_global
$ echo vendor >> ~/.gitignore_global
$ git config --global core.excludesfile ~/.gitignore_global
Reference :
- https://stackoverflow.com/questions/18393498/gitignore-all-the-ds-store-files-in-every-folder-and-subfolder
- https://help.github.com/articles/ignoring-files/
- Github git cheatsheet https://services.github.com/on-demand/downloads/github-git-cheat-sheet/