Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
project:git [2017/08/04 15:39] over23 [Branches / forks] - merging added |
project:git [2017/11/14 07:36] (current) licho |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Git HOWTO : https://github.com/Labka-cz/Irssi_scripts ====== | + | ====== Git HOWTO ====== |
| |**Project owner:**| [[user:overdrive|Overdrive]] | | |**Project owner:**| [[user:overdrive|Overdrive]] | | ||
| Line 6: | Line 6: | ||
| | **License:** | [[https://creativecommons.org/licenses/by-sa/3.0/|Uveďte původ-Zachovejte licenci CC BY-SA]] | | | **License:** | [[https://creativecommons.org/licenses/by-sa/3.0/|Uveďte původ-Zachovejte licenci CC BY-SA]] | | ||
| - | ====== Request access to shared repo by email to Over at labka.cz ====== | + | |
| - | ====== Create project from existing directory ====== | + | {{project:git_data_transport.png}} |
| - | {{ project:git_data_transport.png }} | + | |
| * https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ | * https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ | ||
| * https://git-scm.com/book/cs/v1/%C3%9Avod-Prvn%C3%AD-nastaven%C3%AD-syst%C3%A9mu-Git - cz dokumentace ke gitu | * https://git-scm.com/book/cs/v1/%C3%9Avod-Prvn%C3%AD-nastaven%C3%AD-syst%C3%A9mu-Git - cz dokumentace ke gitu | ||
| + | ====== Create project from existing directory ====== | ||
| ===== Init directory to be used by GIT ===== | ===== Init directory to be used by GIT ===== | ||
| # cd ~/directory | # cd ~/directory | ||
| Line 17: | Line 17: | ||
| # git add . -A ## add all files in repository | # git add . -A ## add all files in repository | ||
| ===== create local ignore file ===== | ===== create local ignore file ===== | ||
| - | * in case you want to add dot files | + | * in case you want to add dot files |
| # git add -f .gitignore | # git add -f .gitignore | ||
| | | ||
| - | ===== global ignore file ===== | + | ===== or global ignore file ===== |
| - | If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command: | + | * If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command: |
| git config --global core.excludesfile ~/.gitignore | git config --global core.excludesfile ~/.gitignore | ||
| + | |||
| ==== example how to exclude all vim tmp files ==== | ==== example how to exclude all vim tmp files ==== | ||
| * inside of .gitignore file you will be | * inside of .gitignore file you will be | ||
| + | |||
| <code> | <code> | ||
| # VIM: Temperory files | # VIM: Temperory files | ||
| *~ | *~ | ||
| - | |||
| # VIM: Swap-files | # VIM: Swap-files | ||
| [._]*.s[a-w][a-z] | [._]*.s[a-w][a-z] | ||
| [._]s[a-w][a-z] | [._]s[a-w][a-z] | ||
| - | |||
| # VIM: Commands :cs, :ctags | # VIM: Commands :cs, :ctags | ||
| tags | tags | ||
| cscope.* | cscope.* | ||
| - | |||
| # VIM session | # VIM session | ||
| Session.vim | Session.vim | ||
| - | |||
| # VIM: netrw.vim: Network oriented reading, writing, browsing (eg: ftp scp) | # VIM: netrw.vim: Network oriented reading, writing, browsing (eg: ftp scp) | ||
| .netrwhist | .netrwhist | ||
| </code> | </code> | ||
| - | | + | ===== 1st commit content to GIT ===== |
| - | # git commit -m "First commit" ## add first commit with comet to be ready to be uploaded to git[hub] | + | # git commit -m "First commit" ## add first commit with coment to be ready to be uploaded to git[hub] |
| - | ## create project directory on GitHub, and copy its link by buton "Clone or download" where you can get its URL | + | # git remote add origin [remote repository URL or SSH link] |
| - | # git remote add origin //remote repository URL// | + | # git push -u origin master ## push you commit to remote URL repo, branch master |
| - | # git push -u origin master ## push you commit to remote URL repo | + | |
| ====== Evey day use of Git[Hub] ====== | ====== Evey day use of Git[Hub] ====== | ||
| + | ===== commit files to git - master ===== | ||
| + | |||
| # cd to already inited directory | # cd to already inited directory | ||
| # git add . -a ## or you can add just specific file | # git add . -a ## or you can add just specific file | ||
| # git commit -m "write what is your commit about" | # git commit -m "write what is your commit about" | ||
| # git push | # git push | ||
| - | | + | |
| - | * when you want to download last changes from with changes from repo, to already inited dir | + | ===== get last version of git repo ===== |
| # git pull | # git pull | ||
| | | ||
| - | ====== Branches ====== | + | ===== Branches ===== |
| Original documentation : https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging | Original documentation : https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging | ||
| Line 69: | Line 69: | ||
| 2. switch to branch | 2. switch to branch | ||
| # git branch [branch_name] | # git branch [branch_name] | ||
| - | # git checkout iss53 | + | # git checkout [branch_name] |
| or you can do git `checkout -b [branch_name]` | or you can do git `checkout -b [branch_name]` | ||
| Line 114: | Line 114: | ||
| # git commit | # git commit | ||
| - | ====== Howto connect GitHub to IRC ====== | + | ===== Notes - userful commands, ToDo ===== |
| - | * ToDo | + | <code> |
| - | ====== Howto create project WebPage directly by GitHub ====== | + | git add classes/system/linux/system/mon.yml -- prida jmenovite soubor |
| - | * ToDo | + | git add -A --stages All |
| + | git add . --stages new and modified, without deleted | ||
| + | git add -u --stages modified and deleted, without new | ||
| + | git commit -a -m "Addition of ext interface to monitoring server node, added system.linux.system.mon" | ||
| + | git log --graph | ||
| + | git push origin HEAD:monitoring | ||
| + | |||
| + | git checkout . --zahodi lokalni zmeny - pred add | ||
| + | git reset -- zahodi zmeni v indexu, taky zahodi nepushnute commity | ||
| + | git clean -f --zahodit untracked soubory - nove soubory, generovane soubory | ||
| + | </code> | ||