Skip to content

Learn GIT & Terminal: Beginner's Guide to Version Control & Command Line

Notifications You must be signed in to change notification settings

UlyanaHanush/Git_assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn GIT & Terminal Learn GIT & Terminal

Learn GIT & Terminal

Beginner's Guide to Version Control & Command Line

Русский

Please note that documentation translations may be outdated; try to use English documentation if possible.

Features

Installing Git

git --version

And if the command is not found, then use this: xcode-select --install

Working with the .gitconfig

git config --global user.name "Practicum"
git config --global user.email [email protected]

List of all config properties

git config --list

Case sensitivity

git config --global core.ignorecase false

Creating a local Git-repository

Creating folder :
mkdir nameFolder
Moving in folder
cd nameFolder
git init

If you need: delate repository
rm -rf .git

Create Add Save

touch file.txt
git add file.txt

Save all file
git add --all
git add .

Make a commit

git commit -m "Text of changes!"

Warning

MUST be on the English layout :q!

Recommendations

consider in detail the service information from the .git folder

Generate SSH-key

Open Terminal and enter the command:
ssh-keygen -t ed25519 -C ""

Next, the command will prompt you to enter the path to the folder where you want to save the key:
Enter file in which to save the key (/Users/practicum/.ssh/id_ed25519)
I recommend agreeing with the proposed option - just press Enter.

Enter a passphrase for the file:
Enter passphrase (empty for no passphrase) This password will be needed every time you try to print part of the key.
The program offers to create a key without a password; to skip a step, press Enter.
Next, run a command that will add the key to the SSH agent (a program that remembers your private SSH key and automatically substitutes it when you connect to the server via SSH) and saves it in the Keychain:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Now copy the public key id_ed25519.pub to the clipboard:
pbcopy < ~/.ssh/id_ed25519.pub

Add an SSH key to your GitHub account

  • Go to GitHub and go to Settings.

Go to GitHub and go to Settings

  • In the left menu, select SSH and GPG keys.

In the left menu, select SSH and GPG keys

  • Click New SSH key or Add SSH key.

Click New SSH key or Add SSH key

  • In the Title field, enter the name of the key (for example, the name of your computer).

In the Title field, enter the name of the key

  • In the Key field, paste the key from the clipboard using the hot keys Cmd + V.

  • Click Add SSH key.

Clone the repository

Open a terminal and go to your projects folder

  • Open your project in GitHub, click the green Code button and copy the project's SSH address

Open your project in GitHub, click the green Code button and copy

Open a terminal and go to your projects folder: git clone [email protected]:/first-project-git.git second-project-git cd second-project-git

Before performing a git pull, make sure that your working version is clean, that is, all changes are committed: a commit is made.
Sometimes, after running a git pull, merge conflicts can arise if the same parts of code have been changed locally and in the remote repository. In this case, Git will ask you to resolve these conflicts before continuing.

Warning

Before performing a git pull, make sure that your working version is clean, that is, all changes are committed: a commit is made. Sometimes, after running a git pull, merge conflicts can arise if the same parts of code have been changed locally and in the remote repository. In this case, Git will ask you to resolve these conflicts before continuing.

Branches

git branch - view project branches
git branch <branch_name>: create a branch
git checkout <branch_name>: switch between branches

You can create a branch and immediately start working on it
git checkout -b another_branch

Merging the branches
git merge new_branch

latest changes from master branch to remote repository
git push -u origin main

you don't have to go to a branch to push it
git push -u origin merge-request

Making a Pull Request

  • Go to the repository page and select the Pull requests tab and click the green New pull request button. Select the names of the branches: the “to” branch (to which the pull request will be sent) and the “from” branch (from which the pull request will go).

Go to the repository page and select the Pull requests tab and click the green New pull request button

The window will display the added commits and their changes. Click Create pull request.
Fill in the fields with the name and description of the pull request. Click Create pull request.
Now you or your colleagues can go to the Files changed tab to leave your comments and conduct a review.
All that remains is to click Merge pull request. This will merge the branch with your changes and the main branch.

Ulyana's GitHub stats

About

Learn GIT & Terminal: Beginner's Guide to Version Control & Command Line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published