Git is git!
Yes I know. Old joke. But in polish git colloquially means – cool.
In this lesson I will show basic comments in git.
But first is first. What is git?
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
So first off all there are two types of repository. Local and remote.
Local is placed on Your computer and and it is not linked to remote repo.
All commands and operation I will show based on terminal. I user iTerm on Mac. Powerfull app.
To create local repo You have to:
mkdir name_folder - create folder cd name_folder - open folder git init - initialization folder for git - name of folder is name of Your folder touch name_file.html - create some file - html, txt whatever e.g git add name_file.html - add file to repository git commit -m "comment" - commit Your repo with comment git status - checking git status
example 1. Creating local repo:
That`s it You create new repo in git. But You can create some branches in Your repo!
Branches are something that tree has. You have root (master) then tree is growing has one two, “n” branches. To create branch use:
git branch name_branch - how can be more simple? git checkout name_branch - switch to you new branch git checkout -b name_new_branch - this is combine of this two first command creating a branch and switching to it.
You can check difference with branches. Just compare two of them:
git diff master name_branch git diff name_new_branch name_branch
Combine two branches? Simple:
gif marge name_branch name_new_branch
You have to remember. To merge two brenches You schould checkout to master. Or if You want to merge branch with master You should do the same.