Skip to content

victorjeman/internship-2021-git-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Git Workshop


Let's learn the basics about git together.



What is vesion control?


πŸ€” Question: What is vesion control?


πŸ€” Question: When you first started to use a version control?


πŸ€” Question: What benefits it gave you?


πŸ€” Question: Does it make sense to use a version control in your personal projects?


πŸ’‘ Version control, also known as source control, is the practice of tracking and managing changes to software code.

πŸ’‘ If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.


What is version control? | atlassian tutorial


Version control system?


πŸ€” Question: What is a version control system?


πŸ€” Question: How many version control systems do you know?



πŸ’‘ There are a lot of version control systems.

List of version-control software


πŸ’‘ Some of the cool ones!


πŸ’‘ Version control systems are software tools that help software teams manage changes to source code over time.

πŸ’‘ Version control software keeps track of every modification to the code in a special kind of database.


15 BEST Version Control Software (Source Code Management Tools)


πŸ€” Question: Version control systems: distributed vs centralized. What is the difference?


πŸ’‘ Centralized VCSs keep the history of changes on a central server from which everyone requests the latest version of the work and pushes the latest changes to. This means that everyone sharing the server* also shares everyone’s work.

πŸ’‘ On a Distributed VCS, everyone has a local copy of the entire work’s history. This means that it is not necessary to be online to change revisions or add changes to the work.

  • Distributed VCS: Git, Mercurial.
  • Centralized VCS: CVS, Perforce, SVN.



What is git?




πŸ’‘ Git is a specific open-source version control system created by Linus Torvalds in 2005 designed to handle projects with speed and efficiency.




Git based platforms



πŸ’‘ There are multiple cloud platforms that are working based on git.




What is GitHub



πŸ’‘ GitHub is a for-profit company that offers a cloud-based Git repository hosting service. Essentially, it makes it a lot easier for individuals and teams to use Git for version control and collaboration.




Playground

STEP 1. Create a GitHub account


Create a GitHub account


STEP 2. Get Git bash


Download Git bash


STEP 3. Get Git bash



TASK 1

πŸ‘‰ Fa clone la proiect.

git clone [email protected]:victorjeman/internship-2021-git-tutorial.git

πŸ‘‰ Verifica branch-ul local pe care te afli. Ar trebuie sa fie branch-ul "main".

git branch

πŸ‘‰ Fa un branch nou si da-i numele "feature/task-1".

git checkout -b feature/task-1

πŸ‘‰ Cu un "git branch" poti sa confirmi ca te afli pe noul branch creat local.

git branch


πŸ‘‰ Creeaza 3 fisiere noi.

touch play/pretty-1.md play/pretty-2.md play/pretty-3.md play/pretty-4.md

πŸ‘‰ Scrie in fiecare fisier urmatorul text.

I feel charming
Oh so charming
It's alarming how charming I feel
And so pretty
That I hardly can believe I'm real

πŸ‘‰ Verifica situatia.

git status

πŸ‘‰ Asa ceva ar trebui sa vezi


πŸ‘‰ Adauga fisierele "pretty-1.md" si "pretty-2.md" in gitul tau local.

git add play/pretty-1.md play/pretty-2.md

πŸ‘‰ Verifica situatia. Trebuie sa ai 2 fisiere cu verde si 2 cu rosu. Fisierele cu verde sunt in staged area.

git status

πŸ‘‰ Adauga un commit cu mesaj si descriere pentru fisierele tale din staged area.

git commit -m "TASK 1 | Am adaugat fisierele pretty-1.md si pretty-2.md" -m "So far so good. Primul task nu pare asa de greu."

πŸ‘‰ Fa push cu modificarile din git-ul tau local(staged area) pe remote(GitHub).

git push origin feature/task-1

πŸ‘‰ Fa un pull request in GitHub.


πŸ‘‰ Fa merge la pull request in branch-ul "main".


TASK 2

πŸ‘‰ Verifica pe ce branch esti pe local.

git branch 

πŸ‘‰ Inainte sa te apuci de un alt task/feature mereu sa mergi inapoi pe branch-ul local "main".

git checkout main 

πŸ‘‰ Sterge branch-ul local "feature/task-1". Dupa ce faci merge la un branch in main, mereu sa-l stergi de pe local.

git branch -D feature/task-1

πŸ‘‰ Daca nu ai sters branch-ul remote(din GitHub) "feature/task-1" cand ai facut merge in "main", sterge-l acum. Mereu sa stergi branch-urile remote dupa ce le faci merge in branch-ul "main".

git push -d origin feature/task-1

πŸ‘‰ Mai verifica o data lista de branch-uri locale. Observa ca branch-ul "feature/task-1 " nu mai apare in lista.

git branch

πŸ‘‰ Inainte sa lucrezi la un nou feature, asigura-te ca branch-ul tau local "main" este la zi cu modificarile din branch-ul "main" remote(de pe GitHub). Fiind pe branch-ul "main" local, faci un git pull de pe branch-ul "main" remote.

git pull origin main

πŸ‘‰ Branch-ul tau local "main" fiind la zi, poti sa faci un alt branch "feature/task-2" care porneste din branch-ul "main".

git checkout -b feature/task-2

πŸ‘‰ Noi in task-ul anterior nu am facut commit si push la toate fisierele. Momentan mai avem doua fisiere care sunt untracked de git(au culoarea rosie).

git status

πŸ‘‰ Adauga ambele fisiere in git-ul tau local. De data asta in loc sa adaugam fiecare fisier in parte o sa adauga toate modificarile modificate.

git add .

πŸ‘‰ Asigura-te ca fisierele tale sunt cu verde, adica adaugate in staged area.

git status

πŸ‘‰ Adauga un commit

git commit -m "TASK 2 | Gata si task-ul 2" -m "Am mai invatat niste chestii noi."

πŸ‘‰ Fa push pe remote(pe git-ul integrat/instalat in GitHub)

git push origin feature/task-2

Task 2 updates


Fiind un task mai complicat o sa lucreze doi developeri la el. Rezultatul final al taskului 2 este sa avem in fisierele "pretty-1.md" si "pretty-2.md" urmatorul text.


I feel handsome
Oh so charming
It's alarming how charming I feel
And so cool
That I hardly can believe I'm real

TASK 2.1


Pasi pentru developer 1


πŸ‘‰ Fa un branch "feature/task-2.1" din branch-ul "feature/task-2"


πŸ‘‰ Confirma ca esti pe branch-ul "feature/task-2"

git branch

πŸ‘‰ Fa branch-ul "feature/task-2.1"

git checkout -b feature/task-2.1

πŸ‘‰ Fa branch-ul "feature/task-2.1"


πŸ‘‰ In fisierul "pretty-1.md" si "pretty-2.md" Acceptance Criteria 1: schimba cuvantul "charming" cu "handsome". Acceptance Criteria 1: Inlocuieste randul 4 cu "++++++" Pentru task-2.1 fisierele "pretty-1.md" si "pretty-2.md" trebuie sa contina

I feel handsome
Oh so charming
It's alarming how charming I feel
++++++
That I hardly can believe I'm real

πŸ‘‰ Pune modificarile pe un branch remote

git add .
git commit -m "TASK 2.1 | Modificare 2.1"
git push origin feature/task-2.1

πŸ‘‰ Fa un pull request prin care vrei sa faci mergi din "feature/task-2.1" in "feature/task-2"


πŸ‘‰IMPORTANT: Nu da merge la pull request

TASK 2.2


Pasi pentru developer 2


πŸ‘‰ Fa un branch "feature/task-2.2" din branch-ul "feature/task-2"


πŸ‘‰ Mai intai schimba-te inapoi pe branch-ul "feature/task-2"

git checkout feature/task-2

πŸ‘‰ Da-i si un "git branch" ca sa confirmi

git branch

πŸ‘‰ Creeaza branch-ul "feature/task-2.2" din branch-ul "feature/task-2"

git checkout -b feature/task-2.2

πŸ‘‰ In fisierul "pretty-1.md" si "pretty-2.md" Acceptance Criteria 1: langa cuvantul charming adauga "and sexy" Acceptance Criteria 2: sterge randu "And so pretty" Pentru task-2.2 fisierele "pretty-1.md" si "pretty-2.md" trebuie sa contina

I feel charming
Oh so charming
It's alarming how charming I feel
And so cool
That I hardly can believe I'm real

πŸ‘‰ Pune modificarile pe un branch remote

git add .
git commit -m "TASK 2.2 | Modificare 2.2"
git push origin feature/task-2.1

Task 2 updates

πŸ‘‰ Fa merge la branch-ul "feature/task-2.1" in "feature/task-2"


πŸ‘‰ Fa merge la branch-ul "feature/task-2.2" in "feature/task-2"


πŸ‘‰ Rezolva conflictele.

πŸ‘‰ Fa merge la "feature/task-2" in "main"

Task 3

Caute in commit-urile vechi si fa o ajustare

git log --all --grep='Task 2.2'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published