TGViewer
LinuxSkill - Сводки с прода и Шпаргалки LinuxSkill - Сводки с прода и Шпаргалки @linuxskill · 10.7K subscribers
Post #1146 3.93K
🚀 Тратишь часы на дебаг веток? Эти 41 команда Git решат 99% твоих задач

Хватит гуглить каждую мелочь — держи ультимативную шпаргалку ровно на 41 команду Git. Только хардкор и рабочие конструкции для консоли.

1. Создание репозитория и сохранение изменений

# Клонировать существующий репозиторий (Clone an existing repository)
$ git clone [url]

# Инициализировать новый проект (Initialize new version-controlled project)
$ git init

# Сохранить изменения в репозиторий (Save changes to the repository)
$ git add .
$ git commit -m "first commit"

# Текущее состояние репозитория (Current state of the repository)
$ git status



2. Управление ветками

# Создать новую ветку (Create a new branch)
$ git branch [branchName]

# Показать все локальные и удаленные ветки (List all remote or local branches)
$ git branch -a

# Удалить ветку (Delete a branch)
$ git branch -d [branchName]

# Слить изменения в текущую ветку (Merge changes into current branch)
$ git merge [branchName]

# Переключиться на существующую ветку (Checkout an existing branch)
$ git checkout [branchName]
$ git switch [branchName]

# Переключиться и создать новую ветку (Checkout and create a new branch with that name)
$ git checkout -b [newBranch]
$ git switch -c [newBranch]



3. Теги, синхронизация и удаленные репозитории

# Создать тег (Create a tag)
$ git tag [tagName]

# Удалить тег (Delete the tag)
$ git tag -d [tagName]

# Отправить теги (Push tags)
$ git push --tags

# Получить последнюю версию репозитория (Get the latest version of a repository)
$ git pull [branchName] [remoteURL/remoteName]

# Добавить удаленный репозиторий (Add remote repository)
$ git remote add [remoteName] [remoteURL]

# Отправить локальные коммиты в удаленный репозиторий (Send local commits to the remote repository)
$ git push [remoteURL/remoteName] [branch]

# Показать URL удаленных репозиториев (Show remote URLs)
$ git remote -v


4. Отмена действий и удаление файлов

# Отменить предыдущий коммит (Undo the previous commit)
$ git revert HEAD^

# Забыть о файлах, которые отслеживались, но теперь в .gitignore (Forget about files that were tracked but are now in .gitignore)
$ git rm -r --cached .
$ git add .
$ git commit -am "remove ignored files"

# Удалить файл из рабочего индекса (Remove a file from the working index (cached))
$ git rm --cached [fileName]

# Удалить файл принудительно (Delete a file (force))
$ git rm -f [fileName]

# Удалить всю директорию из рабочего индекса (Remove an entire directory from the working index (cached))
$ git rm -r --cached [directoryName]

# Удалить всю директорию принудительно (Delete an entire directory (force))
$ git rm -r -f [directoryName]

# Удалить удаленную ветку (Delete a remote branch)
$ git push origin :[branchName]


5. Прятанье изменений (Stash) и базовые настройки

# Спрятать текущую работу с неотслеживаемыми файлами (Store current work with untracked files)
$ git stash -u

# Вернуть спрятанную работу обратно в рабочую директорию (Bring stashed work back to the working directory)
$ git stash pop

# Задать имя автора для всех коммитов (Define the author name to be used for all commits)
$ git config --global user.name [name]

# Задать email автора для всех коммитов (Define the author email to be used for all commits)
$ git config --global user.email [email]

# Полезные руководства, поставляемые с Git (Helpful guides that come with Git)
$ git help -g


6. История, изменения и сложные переносы

# Показать лог коммитов (Show commit log)
$ git log
$ git log --oneline

# Показать изменения (Show changes)
$ git diff

# Изменить сообщение последнего коммита (Amend last commit message)
$ git commit --amend

# Посмотреть, кто менял файл (Blame a file)
$ git blame [fileName]

# Перенести конкретный коммит (Cherry-pick a commit)
$ git cherry-pick [commitHash]

# Выполнить rebase на другую ветку (Rebase onto another branch)
$ git rebase [branchName]


❗️❗️❗️ Нравится формат? Ставь 👍

👉 Рубрика: #шпаргалка@LinuxSkill
⭐️ Зеркало в MAX

#Linux #Git #DevOps #Sysadmin #CLI #Bash
  • 👍 5
More from @linuxskill
  1. Oct 7, 2026Post #1243
  2. Oct 6, 2026GitOps-практики: развёртываем сервис через ArgoCD Классический CI/CD запускает деплой. Но…
  3. Oct 5, 2026Post #1241
  4. Oct 2, 2026📊 Диск тормозит, а iostat показывает норму? Ищем хвост задержек Приложение подвисает на з…
  5. Sep 30, 2026💀 CPU под 100%, а в top пусто? Ловим невидимые процессы через eBPF Сервер греется, в шапк…
  6. Sep 28, 2026🔥 Знаешь только ip a? 10 неочевидных команд ip для Linux Большинство админов знают про ip…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →