Quick git


Working with remote master / local repository

# get a copy of remote repository
git clone

# add all changes to index || git add <filename>
git add *

# add deleted files to index 
git add -u

# delete file from index / repository, keep file on disk
git rm --cached <filename>

# remove file from index which added already
git reset <filename>

# remove all files from index which added already
git reset

# show changes made as diff
git diff --cached

# show changes made file names only
git diff --cached --name-only

# get remote changes, save your changes, add info for changes
git commit -m "changelog message"

# send changes to remote repository
git push origin master

# get single branch
git clone --single-branch --branch <branchname> <remote-repo>


Sync local repository with remote

# check if local and remote repository even, show changed files
git remote update && git status 

# show commit names of changes from local to remote
git show-branch *master

# diff as text
git diff origin/master

# merge remote changes to local repository
git merge origin/master

https://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git
https://stackoverflow.com/questions/2514270/how-to-check-for-changes-on-remote-origin-git-repository?noredirect=1&lq=1


Create local repository send to remote
- https://help.github.com/en/articles/adding-an-existing-project-to-github-using-the-command-line

# init repository
git init

# add new files to repository
git add .

# save your changes, add info for changes
git commit -m "first commit"

# add remote repository
git remote add origin https://github.com/loadenmb/pppFox.git

# check sync
git remote -v

# send local repository to remote
git push origin master


Config files

Commit empty folder & keep
create .gitignore file iń folder:
# keep folder, but empty
*
!.gitignore 

Language detection / wrong language
create .gitattributes file in root folder:
# no auto language detection for files in folder
foldername/* linguist-vendored
Linguist language detection doesn't work perfect if your own source code is smaller as used libs from other languages.
- https://github.com/github/linguist

Sponsor me
https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository

Readme
- https://help.github.com/en/articles/basic-writing-and-formatting-syntax

Headers
# head 1
## head 2
### head 3

Links
[motioneye: mature Python based...](https://github.com/ccrisan/motioneye/)

Lists
- list 1
- list 2

Code
```shell
if [ -x "$TEST" ]; then
```
- https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

Table
| payload type  |  output type  |
| ------------- | ------------- |
| powershell    | powershell    |
| executable    | powershell    |
| executable    | executable    |
| powershell    | executable    |
| powershell    | batch         |
| executable    | batch         |

Bold & Italic
**This is bold text**
*This text is italicized*

Images
![alt text](./relative/image.png "optional title")

Resized images
<img src="./readme/screen_overview.png" width="800" height="600" alt="" />

Icons / Emojis
- https://gist.github.com/rxaviers/7360908
:gift: :see_no_evil: :lollipop: :space_invader:


Related
- https://rogerdudler.github.io/git-guide/