From 227460ec61646325e2006ce744e236688420202c Mon Sep 17 00:00:00 2001 From: Mikhail Chemodanov Date: Mon, 16 Oct 2023 19:29:47 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D1=81=D1=82=20=D0=BF=D0=BE=20=D1=83=D0=BC?= =?UTF-8?q?=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 91 ------------------------------------------------------- 1 file changed, 91 deletions(-) diff --git a/README.md b/README.md index 981bae0..8b13789 100644 --- a/README.md +++ b/README.md @@ -1,92 +1 @@ -# Lesson 02 - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin http://sdb.smtu.ru/gitlab/ros-in-underwater-robotics/lesson-02.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](http://sdb.smtu.ru/gitlab/ros-in-underwater-robotics/lesson-02/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. -- GitLab From 9062ec4df087486fdb07711aa8c9fd7755f1932f Mon Sep 17 00:00:00 2001 From: Mikhail Chemodanov Date: Mon, 16 Oct 2023 19:33:20 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=88=D0=BF=D0=B0=D1=80=D0=B3=D0=B0=D0=BB=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B5=20?= =?UTF-8?q?=D0=B2=20=D1=82=D0=B5=D1=80=D0=BC=D0=B8=D0=BD=D0=B0=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 334 insertions(+) diff --git a/README.md b/README.md index 8b13789..3219b79 100644 --- a/README.md +++ b/README.md @@ -1 +1,335 @@ +*По материалам https://gist.github.com/s3rgeym/82539bf872962044419e2b17c94d5965* +## Тирминал + +В Ubntu придется часто использовать терминал. Его можно вызвать сочетанием клавиш `Ctr+Alt+T`. Важно запомнить, что для большинства команд можно вызвать краткую справку: + +``` + -h +``` + +Или если не работает первая: + +``` + --help +``` + +Некоторые имеют подробный манул: + +``` +man +``` + +Сочетания клавиш для операций копировать, вставить, вырезать работают только с зажатым `Shift`, например, `Shift+Ctrl+V`. + +После запуска терминала мы по-умолчанию находимся в нашем домашнем каталоге. Он обозначается как ~. В терминале тильда в начале пути заменяется на `/home/$USER`. Файл `~/.bashrc` сожержит команды, выполняемые интепретатором баша после запуска (например, при старте терминала). Имена исполняемых фалов, размещенных в каталогах `/usr/bin` или `/usr/local/bin`, доступны как команды. + +`Ctrl+D` - вставить символ EOF закрыть (закрывает терминал). + +Если нужно выполнить одну единственную команду, то можно нажать Alt+F2 и ввести ее в поле. + +## suddo + +sudo - это утилита, позволяющая выполнить команды с правами суперпользователя root. Перед именами команд, которые работают с файловой системой вне домашнего каталога, а так же для остановки root-процессов, нужно писать sudo. sudo используется для консольных приложений, в старых версиях убунту была утилита gksu которая позволяла запускать из под рута графические приложения (показывала окно ввода пароля перед запуском). Из Ubuntu 18.04 убрали ее, вместо нее предлагается использовать что-то типа `gedit admin:///etc/hosts`. + +Если надоело `sudo` вводить можно авторизоваться под рутом: + +``` +sergey@sergey-pc:~$ sudo -i +[sudo] password for sergey: +root@sergey-pc:~# +``` + +Либо можно использовать `sudo -s` или `sudo su`. + +## PATH + +Чтобы использовать в качестве команд исполняемые файлы из других каталогов, нужно добавить их в переменную PATH. В переменной **PATH** хранятся пути, разделенные двоеточиями. Для этого в `~/.bashrc` нужно добавить строку: + +```bash +export PATH="/path/to/executable:$PATH" +``` + +Это важно: если мы вводим команду `python`, то интерпретатор bash начинает сканирование списка каталогов в переменной PATH. Поиск продолжается пока не будет найден исполняемый файл в каком-то из каталогов, именно поэтому старое значение PATH добавляется в конец. + +## Перенаправление вывода + +### Фйловые дескрипторы + +Дескриптор файла - это число, которое ассоциируется с открытым файлом (либо с соединением, так как в Linux все файлы). + +| Значение | Описание | +| -- | -- | +| 0 | stdin - входные данные для сценария (если поддерживает) | +| 1 | stdout - стандартный вывод | +| 2 | stderr - ошибки | + +#### Примеры + +```bash +# Передаем данные в stdin сценария +echo "foo" | somecommand +# Либо так +somecommand <<< "foo" +# Вывод ошибки в stderr +echo "An error has occurred" >&2 +# Игнорирование ошибок. `/dev/null` - как-бы файл в который записываем все, что не хотим видеть в консоли. +somecommand 2> /dev/null +# А можно их записывать в error log. `>>` запись в режиме добавления +somecommand 2>> /path/to/error.log +``` + +### Ссcылки + +* [I/O Redirection](https://www.tldp.org/LDP/abs/html/io-redirection.html) + +## Переменные + +| Имя | Описание | +| -- | -- | +| `$#` | Количество аргументов | +| `$@` | Список аргументов | +| `$0` | Имя исполняемого файла | +| `${1-N}` | Значение аргумента для исполняемого файла либо функции | +| `$_` | Последний аргумент предыдущей команды | +| `$USER` | Текущий пользователь | +| `$HOME` | Домашний каталог | +| `$PWD` | Рабочий каталог (для скрипта тот же что и для сессии терминала) аналог вызова `pwd` | +| `$RANDOM` | Случайное число | + +### Примеры + +#### $_ + +```bash +$ echo test +test +$ echo $_ +test +``` + +## Полезные каманды + +| Команда | Описание | +| -- | -- | +| `!!` | Выполнить предыдущюю команду | +| `cd -` | Перейти в предыдущий каталог | +| `xdg-open ` | Открыть файд в программе по-умолчанию | +| `sudo reboot` | Перезагрузка компьютера | +| `sudo poweroff` | Выключение компьютера | +| `yes \| ` | Ввод и отправка Y при выполнении команды | +| `time ` | Время выполнения команды | +| `strace ` | Вывести список системных вызовов, которые совершает команда | +| `ldd ` | Список зависимостей команды | +| `cal` | Календарь | +| `watch ` | Запуск команды через определенный промежуток времени (2 секунды по-умолчанию) | +| `loginctl lock-session` | Заблокировать экран | +| `loginctl lock-session` | Разблокировать экран | +| `type/wicth COMMAND` | Напечатает путь до обработчика команды | +| `cat /etc/shells` | Список доступных командных оболочек | +| `chsh -s /bin/zsh` | Изменить командную оболочку | +| `./upwork_statistics.py \| sort -k 2 -rn` | Отсортировать выхлоп работы скрипта по второй колонке | +| `ls \| peco` | Выбираем стрелочками нужное | +| `basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat \| cut -d \ -f 4) \| tail -1 \| sed 's/^.* //')` + | Узнать оболочку терминала | + | `dmesg \| less` | Посмотреть сообщения ядра | + +```bash +# move all media files in subdirectories into the current directory +find ./ \( -name '*.JPG' -or -name '*.jpg' -or -name '*.MOV' -or -name '*.mp4' \) -exec mv '{}' ./ \; + +# tar.gz a director +tar czvf wordpress-orig.tar.gz /var/www/ + +# add user to linux +adduser david + +# add existing user to existing group +usermod -g www david +``` + +### Сессия пльзователя + +| Команда | Описание | +| -- | -- | +| `gnome-session-quit` | Выйти из системы | + +### Обработка ошибок + +| Команда | Описание | +| -- | -- | +| `set -e` | Отключить выход из сценария при ошибке. | +| `set +e` | Включить выход из сценария при ошибке. | + +### Операции над строками + +| Команда | Описание | +| -- | -- | +| `expr length $str` | Длина строки | +| `${var#*SubStr}` | will drop begin of string up to first occur of `SubStr` | +| `${var##*SubStr}` | will drop begin of string up to last occur of `SubStr` | +| `${var%SubStr*}` | will drop part of string from last occur of `SubStr` to the end | +| `${var%%SubStr*}` | will drop part of string from first occur of `SubStr` to the end | +| `echo ${first_string/Suzi/$second_string}` | Замена подстроки в строке | +| `${str^^}` | Перевод строки в верхний регистр в Bash 4.0 | +| `echo $str \| tr a-z A-Z` | Тоже в более ранних версиях | +| `echo "${str,,}"` | Перевод строки в нижний регистр в Bash 4.0 | +| `echo $str \| tr '[:upper:]' '[:lower:]'` | Тоже в более ранних версиях | +| `base64 <<< "Привет, мир!"` | Закодировать строку в base64 | +| `echo \| base64 --decode` | Обратная операция | +| `dd if=/dev/urandom \| hexdump -C \| less` | Просмотр данных в HEX | + +### Информация о системе + +| Команда | Описание | +| -- | -- | +| `cat /etc/*-release` | Информация о дистрибутиве | +| `lsb_release -cs` | Кодовое имя дистрибутива | +| `lscpu` и `sudo lshw -class processor` | Информация о процессоре | +| `cat /proc/cpuinfo \| grep name \| uniq` | Модель процессора | +| `arch` или `uname -m` | Архитектура процессора | +| `nproc` или `cat /proc/cpuinfo \| grep process \| wc -l` | Количество ядер процессора | +| `sudo lshw -C display` | Информация о видеокарте | +| `free -m` | Доступная и используемая оперативная память | +| `cat /proc/meminfo` | Подробная информация по оперативной и виртуальной памяти | +| `sudo dmidecode --type 17` | Тип и размер оперативной памяти | +| `sudo fdisk -l \| grep "Disk /dev/sd"` | Список дисков | +| `cat /proc/uptime` | Сек., время работы CPU и время простоя в сумме для каждого ядра | +| `sudo lshw -C display` | Информация о видеоадаптерах | +| `sudo dmidecode -t baseboard` | Модель материнской платы | +| ` sudo smartctl -A /dev/nvme0` | Проверить состояние SSD | +| `df -h --total` | Информация об используемом месте на различных носителях | + +### Арифметическии операции + +| Команда | Описание | +| -- | -- | +| `expr 2 + 2` или `echo $((2+2))` | Выполняет выражение и возвращает результат | + +### Процессы + +| Команда | Описание | +| -- | -- | +| `top` | Мониторинг процессов | +| `top -p PID` | Следим за расходом рксурсов одним процессом | +| `pstree` | Дерево процессов | +| `ps aux` | Список всех процессов | +| `ps aux \| grep python` | Список всех процессов python | +| `kill ` | Остановить процесс по идентификатору | +| `killall firefox` | Остановить все процессы с именем firefox | +| `killall -r gunicorn` | Остановить все процессы соотв регулярке | +| `exec -a ` | Запуск процесса под именем | +| `pkill -f ` | Остановка процесса с именем | + +### Файловая сстема + +| Команда | Описание | +| -- | -- | +| `exec 3>out.txt` | Открыть файл в режиме чтения и записи и получить дескриптор файла | +| `echo "Some line" >&3` | Записать строку в файл, используя дескриптор файла | +| `cat <&3` | Прочитать данные из дескриптора | +| `3>&-` | Закрыть дескриптор файла | +| `> ` | Очистить файл | +| `file ` | Тип содержимого файла | +| `sudo -- sh -c "printf '127.0.0.1\tholocaust\n' >> /etc/hosts"` | Добавить строку в файл с рут-привелегиями | +| `-b filename` | Block special file | +| `-c filename` | Special character file | +| `-d directoryname` | Check for directory Existence | +| `-e filename` | Check for file existence, regardless of type (node, directory, socket, etc.) | +| `-f filename` | Check for regular file existence not a directory | +| `-G filename` | Check if file exists and is owned by effective group ID | +| `-G filename set-group-id` | True if file exists and is set-group-id | +| `-k filename` | Sticky bit | +| `-L filename` | Symbolic link | +| `-O filename` | True if file exists and is owned by the effective user id | +| `-r filename` | Check if file is a readable | +| `-S filename` | Check if file is socket | +| `-s filename` | Check if file is nonzero size | +| `-u filename` | Check if file set-user-id bit is set | +| `-w filename` | Check if file is writable | +| `-x filename` | Check if file is executable | +| `cat` | чтение из основного потока до <EOF> | +| `cat ` | просмотр содержимого файлов | +| `cd ` | навигация по каталогам | +| `cp ` | копирование файлов/каталогов | +| `mv ` | перемещение файлов/каталогов | +| `mkdir ` | создание каталогов | +| `nano ` | редактировать файд | +| `rm ` | удаление файлов/каталогов | +| `rmdir ` | удалить пустой каталог | +| `rm -rf ` | Удалить каталог со всем его содержимым | +| `rm *.txt` | Удалить все файлы с расширением `.txt` | +| `ln -s ` | Создание мягкой ссылки | +| `df -h` | Информация о файловой системе | +| `sudo fdisk -l` | Инофрмация о "дисках" | +| `tar -xvf ` | Извлечь файлы из архива в текущий каталог | +| `tar -xvf -C /path/to/extract` | Извлечь файлы из архива в другой каталог | +| `tar -zcvf hydra.tgz --exclude=hydra/.venv hydra` | Заархивировать папку, игнорируя содержимое .venv | +| `unzip file.zip -d /path/to/directory` | Извлечь содержимое zip-архива в каталог | +| `curl -s http://exmaple.org/file.zip \| tar -xvf -` | Скачать файл и разархивировать | +| `readlink -f file.ext` | Получить полный путь до файла | +| `find . -type f` | Вывести список файлов в директории рекурсивно | +| `umount /dev/sd[XN]` | Размонтировть устройство (например, перед форматированием) | +| `mkfs /dev/sda1` | Отформатировать раздел | +| `sudo dd if=/dev/sda of=/dev/sdb conv=notrunc,noerror` | Копировать жесткий диск | +| `script_dir=$(dirname $0)` | Текущий каталог для скрипта | +| `grep -Pri <текст_для_поиска> <путь_к_директории>` | Поиск файлов по содержимому | +| `zless`, `zcat`, `zgrep` | Аналоги команд с похожими названиями, но работающие с архивами | +| `$ find . -name '*.pdf' \| cpio -pdm ~/Documents/Books` | Копировать файлы с опр. расширением в нужный каталог | +| `df -k .` | Размер и свободное место текущего раздела | +| `df -k /dev/mapper/ubuntu--vg-root` | | +| `mount` | Все точки монтирования | +| `findmnt --target /tmp` | Покажет раздел на котором находится каталог | +| `du -h ` или `du -hcs `| Размер каталога | + +### Установка и удаление пакетов + +| Команда | Описание | +| -- | -- | +| `sudo apt-get update` | Обновить список пакетов | +| `sudo apt-get upgrade` | Обновить все пакеты | +| `sudo apt-get install -y` | Установить пакет без подтверждления | +| `sudo apt-get remove ` | Удалить пакет | +| `sudo apt-get autoremove` | Удалить неиспользуемые пакеты | +| `sudo apt-get clean` | Удалить загруженне архивы | +| `apt list --installed` | Список установленныхпакетов | +| `sudo dpkg -i <.deb package>` | Установить либо обновить deb-пакет | +| `sudo apt-get install -f` | При ошибке предудыщей выполните эту и повторите | +| `sudo dpkg -p ` | Удалить deb-пакет с сохранением конфигураций | +| `sudo dpkg -P ` | Удалить deb-пакет с конфигурациями | +| `dpkg -l \| less` | Просмотр списка установленных deb-пакетов | +| `./configure && make && sudo make install` | Установить из исходников | + +Помимо `apt-get` на Ubuntu доступен пакетный менеджер `snap`. Он более продвинутый. Все доступные пакеты для установки с помощью него можно увидеть на сайте [snapcraft.io](http://snapcraft.io). + +Also: **GDebi Package Installer** - программа для установки `.deb` пакетов. + +### Сервсы + +| Команда | Описание | +| -- | -- | +| `service --status-all` | Список сервисов | +| `systemctl list-unit-files --type=service \| grep enabled` | Список включенных сервисов | +| `journalctl -xe` | Журнал ошибок сервисов | + +### Сеть + +| Команда | Описание | +| -- | -- | +| `netstat -lt` | Список всех серверов, запущенных на хосте | +| `printf 'GET / HTTP/1.0\r\nHost: google.com\r\n\r\n' \| nc google.com 80` | Отправить сырой TCP-запрос | +| `curl -d -H "Content-Type: application/json" -X POST `| Отправить JSON-апрос через POST | +| `exec {дескриптор-файла}<>/dev/{протокол}/{адрес-узла}/{номер-порта}` | Открыть TCP/UDP соединение (дескриптор - целое число больше 2) | +| `wget url -O - \| sh` | Выполнить удаленный скрипт | +| `ssh -D 1080 -N user@server` | Создать socks-туннель (localhost:1080) | + +Выкачать весь сайт: + +```bash +wget --mirror \ + --convert-links \ + --html-extension \ + --wait=2 \ + -o log \ + http://howisoldmybusiness.com +``` -- GitLab From d79682ee5f388af01b066b98c9d9b86d7752b6d3 Mon Sep 17 00:00:00 2001 From: Mikhail Chemodanov Date: Mon, 16 Oct 2023 19:40:14 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D0=BC=D0=B8=D0=BD=D0=B0=D0=BB=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20?= =?UTF-8?q?git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 3219b79..bce4b57 100644 --- a/README.md +++ b/README.md @@ -333,3 +333,39 @@ wget --mirror \ -o log \ http://howisoldmybusiness.com ``` +### Git + +| Команда | Описание | +| -- | -- | +| `git config --global user.email email@example.com` | Указать email пользователя | +| `git config --global user.name "John Doe"` | Указать имя пользователя | +| `git config --global credential.helper "cache --timeout=2592000"` | Хранить введенные логин и пароль в течении 30 дней | +| `git clone https://github.com/requests.git` | Создать локальную копию репозитория | +| `git pull` | Обновить локальный репозиторий с сервера | +| `git reset --hard` | Please commit your changes or stash them before you merge | +| `git add .` | Добавить все файлы из текущего и вложенных каталогов | +| `git reset` | Отменить предыдущую операцию | +| `git restet ` | отмена добавления файла | +| `git commit -m "message"` | Коммитим измения с целью их публикации| +| `git push` | Загружаем измененнные файлы на сервер | +| `git checkout ` | Меняем ветку | +| `git checkout -b ` | Создаем новую ветку и переключаемся на нее | +| `git rm -r --cached` | Удалить каталог из отслеживания| +| `git subtree push --prefix ` | Push отдельной папки | +| `git log --all --grep=` | Поиск коммита по названию | +| `git log -S` | Поиск коммита по содержимому | +| `git log -n 10` | вывести 10 последних коммитов | +| `git stash` | Сохранить и откатить измения (многие действия не возможно сделать без пуша) | +| `git stash apply` | Восcтанавливаем откаченные изменения | +| `git show HASH:path/to/file` | посмотреть старую версию файла | + +### Git Flow + +Git Flow - это обертка над git. + +| Команда | Описание | +| -- | -- | +| `git flow init` | Сначала нужно инициализировать git flow | +| `git flow feature start DEV-97` | Начать новую фичу | +| `git checkout develop && git pull origin` | Если предыдущая команда возвращает ошибку: `Branches 'develop' and 'origin/develop' have diverged...` | +| `git flow feature publish` | Опубликовать фичу (перед этим нужно добавить изменения и сделать коммит) | -- GitLab