
Git
Git
GitHub is a platform that brings developers from all over the world together. It's a place where anyone can store their projects, share ideas, and discover something new. I use GitHub as a space not just to store my code but also to learn by exchanging knowledge with others.
GitHub — это платформа, которая объединяет разработчиков со всего мира. Здесь каждый может хранить свои проекты, делиться идеями и находить что-то новое для себя. Я использую GitHub как место, где могу не только хранить свой код, но и учиться, обмениваясь опытом с другими.
Git Installation
Установка Git
Windows
Windows
https:/git-scm.com/downloadsArch Linux
Arch Linux
sudo pacman -S git
Debian/Ubuntu Linux
Debian/Ubuntu Linux
sudo apt install git
Repository (repo) it’s a place where you can store your code, your files, and each file's revision history. Repositories can have multiple collaborators and can be either public or private.
Репозиторий (repo) - это место, где вы можете хранить свой код, свои файлы и историю изменений каждого файла. В репозиториях может быть несколько соавторов, и они могут быть как общедоступными, так и частными.
A branch is essentially a unique set of code changes with a unique name. Each repository can have one or more branches. The main branch is the one into which all changes are eventually merged, and is called the main branch. This is the official working version of your project, which you see when you log into the project repository via the main link `github.com/user/repo `.
Ветка (branch) - это, по сути, уникальный набор изменений кода с уникальным именем. У каждого репозитория может быть одна или несколько ветвей. Основная ветвь — та, в которую в конечном итоге объединяются все изменения, и называется главной. Это официальная рабочая версия вашего проекта, которую вы видите, когда заходите в репозиторий проекта по главной ссылке `github.com/user/repo`.
Git also has a UI version with an interface (github desktop), but for now we’ll learn to use it through the terminal. Below I have listed the frequently used commands when working with Git.
У Git'а есть и UI версия с интерфейсом (github desktop), но пока мы научимся использовать его через терминал. Ниже я перечислил часто используемые команды при работе с Git.
Login
Логин
sudo [pacman/apt] [install/-S] [gh/github-cli]
gh auth login
Creation Repository
Создание репозитория
gh repo create name --public
git init
echo "# name of repo" >> README.md
echo "dir/" >> .gitignore
git add *
git add .gitignore
git commit -m "[version name]"
git branch -M main
git remote add origin https://github.com/equa-tory/[name].git
git push -u origin main
Pushing of Repository
Публикация репозитория (Push)
git add *
git commit -m "[version name]"
git push
Fetch and Pull (Update)
Обновление репозитория (Fetch/Pull)
git fetch
git pull
Branches
Ветки (Branches)
git branch -r #view remote branches
git branch [branch name] #create new
git chechout [branch name] #change branch
git branch -r #посмотреть удаётные ветки
git branch [branch name] #создать новую
git chechout [branch name] #сменить ветку
27.08.2024