Sunteți pe pagina 1din 11

Tema laboratorului 1:

"Versionarea codului sursa utilizand GIT". Lucrarea de laborator are ca scop


studiul și înțelegerea principiilor de funcționare și utilizare a sistemului distribuit
de control al versiunilor numit GIT.

Terminologie
 repository - pe server, conține ierarhia de fișiere și informațiile de versiune;
 working copy - varianta locală, obținuta de la server, pe care se fac
modificările;
 revision - o versiune a unui document. (v1, v2, v3...).
 checkout - aducerea pe masina locala a versiunii de pe server, sub forma
unei working copy
 update/pull: actualizarea repozitoriului local în funcție de modificările
survenite, intre timp, pe server. Se aduc doar fișierele modificate;
 commit - înregistrează o nouă versiune a fișierului (fișierelor) modificat în
repozitoriu.
 commit message - un mesaj asociat unei acțiuni commit care descrie
schimbările făcute în noua versiune.
 changelog - o listă a versiunilor (commit-urilor) unui fișier/proiect de obicei
însoțită de mesajele asociate fiecărui commit.
 diff: Afișează diferențele dintre două versiuni a unui fișier sau dintre fișierul
modificat local (pe working copy) și o versiune de pe repository.
 revert - renunțarea la ultimele modificări (locale) făcute într-un fișier
din working copy, și revenirea la ultima versiune aflată în repozitoriu sau la o
versiune la alegere.
 branch - creează o “copie” a unui fișier/proiect pentru modificări „în paralel”
fără a afecta starea actuală a unui proiect.
 merge - aplică ultimele modificări dintr-o versiune a unui fișier peste alt fișier;
 conflict - situația în care un merge nu se poate executa automat și modificările
locale sunt în conflict cu modificările din repozitoriu.
 resolve: rezolvarea (de obicei manuală) a conflictelor apărute într-un fișier după
un merge.
Indicatii metodice:

1) Preparing the environment

 install Git on our machine


 create a GitHub account
 create a workspace on our machine

If you’ve already done this, you can go straight to the GitHub’s workflow and the
Terminal section.

2) Installing Git on your machine


Git installation is different on each operation system. Check out Git’s official site to
see which way is right for you.

Once Git is installed, we need to create a GitHub account and configure it on our
machine.

3) Creating an account on GitHub


To create an account, go to the GitHub web site and fill out the main form.

You need to inform GitHub which plan you want to use. Choose the free option.
The only difference is that you can setup private repositories with the paid plan.
4) Setting up our system with our GitHub data
Open up your Terminal. In Windows, you have to open the start menu and
type cmd. Then click enter.

git config --global user.name "our_GitHub_user_name"

git config --global user.email "our_GitHub_user_email"

5) Setting up your GitHub access key

To create this key, follow the process outlined in the GitHub documentation.

6) Create a new project


Let’s get back to your GitHub page and click on the plus icon (+) at the top of the
page.

7) Create your workspace

Run the command mkdir folder_name to create the workspace. For example:
mkdir workspace
8) Clone your repositories
Cloning a repository means that you’ll copy all of the files and directories on the
GitHub server onto your machine so you can work with them.

Now you need to clone the project that you created on GitHub to
your workspace. To do this, go to the folder that you just created. On cmder, type:

cd workspace\

Tip: if you created the folder or want to access one which already exists, you can
start typing its name and hit TAB, and cmder will autocomplete the name for you.

With that, go to your project page on GitHub and get the link that you need to clone
the repository.

The link is in that green button named Clone or Download:

Getting the link to clone your repo.

Change from HTTPS to SSH, because you already configured your access key in
your account.
Changing https to ssh link.

Now you can run the git clone command and pass the link that you get. Just like
that:

git clone git@github.com:our-username/learning-html.git

And your repository will be cloned, like in the following picture:

Clone confirmation message.

You can access the repository folder which was created in your workspace when
you cloned it.
Type the command: cd learning-html/

Attention: I’m assuming that you are inside the workspace diretory now. If you
aren’t, the above command will not work. Use cd %home%\workspace\ and then
the above command.
9) Create a branch
Every time you change something in a project versioned with Git, you should create
a branch with the name of the task which you’re working on. This prevents you
from messing up the “main” code located on the master branch. For this, you can
use the following command:

git checkout -b task_name

A branch is like a tree branch. It’s part of the trunk of the tree. So you can make
changes in parallel with the main part of the project without affecting it.

For example:

Changing branch.

Once you’ve done this, you can change automatically to the newly created branch
and can code like crazy now.

10) Commit the changes


Once you finish a change to your project, you should commit the change to your
remote repository (the one on GitHub’s servers).

To commit something is to tell Git that you are putting your changes in the queue
to be pushed (sent) to your remote repository.

Imagine that you just created an HTML page and added some titles and text to it.
You have the first version of this document now, so you should commit it.
To do this, run some commands so that Git understands that we want to send our
changes do the remote repo. Run git add file_name to tell Git to stage the file.
Alternatively, you can run git add --all to send all the files that you made some
changes to. With the git status command, you can see which changed files you will
commit to the server.

Example of the first version of a file.

In the above example, the index.html file was created and the git status command
was run to see what was changed. Then the file was added with git add and git
status was run again to see which file was added to the Git workspace.
With that you can now commit the changes. Just run the git commit command, just
like git commit -m "commit_message". Remember to include a descriptive message
of what was added to the commit.

11) Merging the changes


After you’ve committed the changes, you now have a branch with modifications
ahead of the ones in the master branch. That means that you have a different
version of the project, and you need to merge those changes with the main version
of the project. Before doing that, verify what the differences are between the
branches. On your branch, perform the command:
git diff master

The output will be something like:

Git diff output.

Git shows you the newest commit made, which files were added or changed, and
what was changed as well.
Since you know that you have differences between your branch and the master, you
need to merge them to join the new commits, which you made in your branch, with
the code in the master. To do this, you need to go to the master branch, on cmd, and
run the command git merge .
To get back to the master, run git checkout master . To merge the commits, run git
merge our_branch_name .
Merging example.

Git will show you an output confirming what was added.

12) Sending it to GitHub


After you’ve made and merged all the changes, you can now send them to your
remote repository on GitHub.
You will use git push origin master to do this.
Push our changes to the remote repo.

You can also just use git push . It’ll have the same result. But when you push
changes for the first time on your workspace, you need to do git push origin
master so that Git will know that your workspace is the origin of the push.

Now your commit will appear on your GitHub repository’s page:

The last commit which we just did is showed on the project’s page on github.
Documentatie:

 https://help.github.com/articles/adding-a-new-ssh-key-to-your-
github-account/#platform-windows
 https://services.github.com/on-demand/downloads/github-git-
cheat-sheet.pdf

S-ar putea să vă placă și

  • Lab 1
    Lab 1
    Document3 pagini
    Lab 1
    Сергей Борта
    Încă nu există evaluări
  • Lab#1 PR
    Lab#1 PR
    Document5 pagini
    Lab#1 PR
    Alexandru Dumbrava
    Încă nu există evaluări
  • Lab1 Git Ro
    Lab1 Git Ro
    Document17 pagini
    Lab1 Git Ro
    Rosca Doinita
    Încă nu există evaluări
  • Lab.6 FC
    Lab.6 FC
    Document3 pagini
    Lab.6 FC
    Cristina Florea
    Încă nu există evaluări
  • Lab 1 Somipp
    Lab 1 Somipp
    Document5 pagini
    Lab 1 Somipp
    Augusta Bucataru
    Încă nu există evaluări
  • A1
    A1
    Document11 pagini
    A1
    Amarfii Sergiu
    Încă nu există evaluări
  • Examen TIDPP
    Examen TIDPP
    Document3 pagini
    Examen TIDPP
    Rosca Doinita
    Încă nu există evaluări
  • Lab 1 Somipp
    Lab 1 Somipp
    Document7 pagini
    Lab 1 Somipp
    TîmburŞtefan
    Încă nu există evaluări
  • Lab 3
    Lab 3
    Document4 pagini
    Lab 3
    Rosca Doinita
    Încă nu există evaluări
  • Lab 1 Tmps
    Lab 1 Tmps
    Document5 pagini
    Lab 1 Tmps
    Victor Turculet
    Încă nu există evaluări
  • SOMIPP
     SOMIPP
    Document6 pagini
    SOMIPP
    Damean Alexandra
    Încă nu există evaluări
  • Somipp Linux 4 UTM
    Somipp Linux 4 UTM
    Document4 pagini
    Somipp Linux 4 UTM
    Cristi Poselețchi
    Încă nu există evaluări
  • Lab. 3
    Lab. 3
    Document5 pagini
    Lab. 3
    Cristina Florea
    Încă nu există evaluări
  • Somipp Raspunsuri
    Somipp Raspunsuri
    Document82 pagini
    Somipp Raspunsuri
    Augusta Bucataru
    Încă nu există evaluări
  • PS TS
    PS TS
    Document14 pagini
    PS TS
    Victor Turculet
    Încă nu există evaluări
  • Somipp Linux 3 UTM
    Somipp Linux 3 UTM
    Document7 pagini
    Somipp Linux 3 UTM
    Cristi Poselețchi
    Încă nu există evaluări
  • TW Lab 6
    TW Lab 6
    Document6 pagini
    TW Lab 6
    DanuIepuras
    Încă nu există evaluări
  • Git Laborator 1
    Git Laborator 1
    Document1 pagină
    Git Laborator 1
    Daniil
    Încă nu există evaluări
  • SOMIPP Lab6
    SOMIPP Lab6
    Document4 pagini
    SOMIPP Lab6
    Dan
    Încă nu există evaluări
  • Lab 1 BD
    Lab 1 BD
    Document7 pagini
    Lab 1 BD
    Augusta Bucataru
    Încă nu există evaluări
  • Lab 5 TMPS
    Lab 5 TMPS
    Document3 pagini
    Lab 5 TMPS
    Guzun Ion
    Încă nu există evaluări
  • Lab3 PR
    Lab3 PR
    Document22 pagini
    Lab3 PR
    Constantin
    Încă nu există evaluări
  • Lab 7
    Lab 7
    Document5 pagini
    Lab 7
    danielploaia
    Încă nu există evaluări
  • Lab1 Somipp
    Lab1 Somipp
    Document14 pagini
    Lab1 Somipp
    Jen4ik
    100% (1)
  • Somipp Linux 1 UTM
    Somipp Linux 1 UTM
    Document10 pagini
    Somipp Linux 1 UTM
    Cristi Poselețchi
    Încă nu există evaluări
  • Amoo 2
    Amoo 2
    Document8 pagini
    Amoo 2
    AlionaCrigan
    Încă nu există evaluări
  • Lab4 AMOO
    Lab4 AMOO
    Document6 pagini
    Lab4 AMOO
    Mihai Ciubotaru
    100% (1)
  • Amo 5
    Amo 5
    Document8 pagini
    Amo 5
    Fil Gorea
    Încă nu există evaluări
  • Somipp Linux 2 UTM
    Somipp Linux 2 UTM
    Document7 pagini
    Somipp Linux 2 UTM
    Cristi Poselețchi
    Încă nu există evaluări
  • LL2 Baze de Date
    LL2 Baze de Date
    Document15 pagini
    LL2 Baze de Date
    Anya Mr
    Încă nu există evaluări
  • TW Lab 5
    TW Lab 5
    Document4 pagini
    TW Lab 5
    danielploaia
    Încă nu există evaluări
  • SOMIPP Lab1
    SOMIPP Lab1
    Document6 pagini
    SOMIPP Lab1
    violina
    Încă nu există evaluări
  • Lab7 AMOO
    Lab7 AMOO
    Document11 pagini
    Lab7 AMOO
    Сергей Борта
    Încă nu există evaluări
  • Examen PW
    Examen PW
    Document71 pagini
    Examen PW
    DorinRotaru
    Încă nu există evaluări
  • Raport 2
    Raport 2
    Document9 pagini
    Raport 2
    sergiu
    Încă nu există evaluări
  • Lab. 2
    Lab. 2
    Document7 pagini
    Lab. 2
    Cristina Florea
    Încă nu există evaluări
  • SOMIPP Lab5
    SOMIPP Lab5
    Document4 pagini
    SOMIPP Lab5
    X3 KTO
    Încă nu există evaluări
  • Examen IOC Chirtoacă Maxim
    Examen IOC Chirtoacă Maxim
    Document3 pagini
    Examen IOC Chirtoacă Maxim
    Maxim Chirtoacă
    Încă nu există evaluări
  • Lab2 (TS)
    Lab2 (TS)
    Document7 pagini
    Lab2 (TS)
    Zeul Hriscei
    Încă nu există evaluări
  • Lab 1
    Lab 1
    Document7 pagini
    Lab 1
    Augusta Bucataru
    Încă nu există evaluări
  • Lab 2 Pam
    Lab 2 Pam
    Document5 pagini
    Lab 2 Pam
    Augusta Bucataru
    Încă nu există evaluări
  • Raspunsuri AMSI
    Raspunsuri AMSI
    Document11 pagini
    Raspunsuri AMSI
    Cristina Florea
    Încă nu există evaluări
  • PAM
    PAM
    Document3 pagini
    PAM
    nicu zuza
    Încă nu există evaluări
  • SecrieruAndrei Amoo Lab5
    SecrieruAndrei Amoo Lab5
    Document6 pagini
    SecrieruAndrei Amoo Lab5
    andy secrieru
    Încă nu există evaluări
  • Laborator NR.2
    Laborator NR.2
    Document9 pagini
    Laborator NR.2
    Daniil
    Încă nu există evaluări
  • Lab 7
    Lab 7
    Document2 pagini
    Lab 7
    Cristina Florea
    Încă nu există evaluări
  • SOMIPP7
    SOMIPP7
    Document3 pagini
    SOMIPP7
    Damean Alexandra
    Încă nu există evaluări
  • SOMIPP Lab 5
    SOMIPP Lab 5
    Document5 pagini
    SOMIPP Lab 5
    Augusta Bucataru
    Încă nu există evaluări
  • TVPP Laborator nr.3
    TVPP Laborator nr.3
    Document5 pagini
    TVPP Laborator nr.3
    Ion Popescu
    0% (1)
  • Lab3 (TS)
    Lab3 (TS)
    Document7 pagini
    Lab3 (TS)
    Zeul Hriscei
    Încă nu există evaluări
  • SOMIPP Lab4
    SOMIPP Lab4
    Document7 pagini
    SOMIPP Lab4
    Dan
    Încă nu există evaluări
  • Iepuras Daniel Lab 1 TS
    Iepuras Daniel Lab 1 TS
    Document4 pagini
    Iepuras Daniel Lab 1 TS
    DanuIepuras
    Încă nu există evaluări
  • Capitolul II Limbajul UML
    Capitolul II Limbajul UML
    Document34 pagini
    Capitolul II Limbajul UML
    torjocf
    Încă nu există evaluări
  • Lab 2 BD
    Lab 2 BD
    Document19 pagini
    Lab 2 BD
    Augusta Bucataru
    Încă nu există evaluări
  • 01 Versionare
    01 Versionare
    Document17 pagini
    01 Versionare
    Stefanescu Mircea
    Încă nu există evaluări
  • Technologii WEB UTM 2020 Lab 1
    Technologii WEB UTM 2020 Lab 1
    Document10 pagini
    Technologii WEB UTM 2020 Lab 1
    Igor
    Încă nu există evaluări
  • PR Lab1
    PR Lab1
    Document10 pagini
    PR Lab1
    Maria Sevciuc
    Încă nu există evaluări
  • LAb 1 IDweb
    LAb 1 IDweb
    Document4 pagini
    LAb 1 IDweb
    Augusta Bucataru
    Încă nu există evaluări
  • Git PDF
    Git PDF
    Document12 pagini
    Git PDF
    pelikanul2004
    Încă nu există evaluări
  • Suport Curs Git
    Suport Curs Git
    Document18 pagini
    Suport Curs Git
    Popa Alex
    Încă nu există evaluări
  • Algoritmul de Criptografie DSA
    Algoritmul de Criptografie DSA
    Document2 pagini
    Algoritmul de Criptografie DSA
    DumitruGuba
    Încă nu există evaluări
  • Plia 4 141
    Plia 4 141
    Document55 pagini
    Plia 4 141
    Ion Popescu
    Încă nu există evaluări
  • Instr CET08
    Instr CET08
    Document4 pagini
    Instr CET08
    Oleg Botnaru
    Încă nu există evaluări
  • Tema: Algoritmul de Criptografie RSA: Functionare
    Tema: Algoritmul de Criptografie RSA: Functionare
    Document2 pagini
    Tema: Algoritmul de Criptografie RSA: Functionare
    Ion Popescu
    Încă nu există evaluări
  • Plia 4 14
    Plia 4 14
    Document34 pagini
    Plia 4 14
    Ion Popescu
    Încă nu există evaluări
  • Plia 4 14
    Plia 4 14
    Document34 pagini
    Plia 4 14
    Ion Popescu
    Încă nu există evaluări
  • Lab1 Pam
    Lab1 Pam
    Document9 pagini
    Lab1 Pam
    Ion Popescu
    100% (2)
  • Exemplu Raport
    Exemplu Raport
    Document27 pagini
    Exemplu Raport
    Fil Gorea
    Încă nu există evaluări
  • Laboratorul nr.1
    Laboratorul nr.1
    Document1 pagină
    Laboratorul nr.1
    Ion Popescu
    Încă nu există evaluări
  • Plia 4 14
    Plia 4 14
    Document34 pagini
    Plia 4 14
    Ion Popescu
    Încă nu există evaluări
  • Lab 3
    Lab 3
    Document8 pagini
    Lab 3
    Ion Popescu
    Încă nu există evaluări
  • Plia 3 15
    Plia 3 15
    Document37 pagini
    Plia 3 15
    Ion Popescu
    Încă nu există evaluări
  • Lab 1
    Lab 1
    Document6 pagini
    Lab 1
    Ion Popescu
    Încă nu există evaluări
  • Lab 2
    Lab 2
    Document2 pagini
    Lab 2
    Ion Popescu
    Încă nu există evaluări
  • Plia 7
    Plia 7
    Document53 pagini
    Plia 7
    Ion Popescu
    Încă nu există evaluări
  • Plia 4 141
    Plia 4 141
    Document55 pagini
    Plia 4 141
    Ion Popescu
    Încă nu există evaluări
  • Functionare
    Functionare
    Document4 pagini
    Functionare
    Ion Popescu
    Încă nu există evaluări
  • Plia 4 141
    Plia 4 141
    Document55 pagini
    Plia 4 141
    Ion Popescu
    Încă nu există evaluări
  • Cuprins
    Cuprins
    Document3 pagini
    Cuprins
    Ion Popescu
    Încă nu există evaluări
  • Exemplu
    Exemplu
    Document1 pagină
    Exemplu
    Ion Popescu
    Încă nu există evaluări
  • Plia 1 15
    Plia 1 15
    Document53 pagini
    Plia 1 15
    Ion Popescu
    Încă nu există evaluări
  • Plia 2 15
    Plia 2 15
    Document40 pagini
    Plia 2 15
    Ion Popescu
    Încă nu există evaluări
  • Algoritmul de Criptografie DSA
    Algoritmul de Criptografie DSA
    Document2 pagini
    Algoritmul de Criptografie DSA
    DumitruGuba
    Încă nu există evaluări
  • Else Fcim Utm MD PDF
    Else Fcim Utm MD PDF
    Document2 pagini
    Else Fcim Utm MD PDF
    Ion Popescu
    Încă nu există evaluări
  • Ciclu Prelegeri TVPP
    Ciclu Prelegeri TVPP
    Document100 pagini
    Ciclu Prelegeri TVPP
    Mihai Coșleț
    Încă nu există evaluări
  • HGJHB
    HGJHB
    Document19 pagini
    HGJHB
    Ion Popescu
    Încă nu există evaluări
  • SI Lab 1 Zubcov Olga
    SI Lab 1 Zubcov Olga
    Document17 pagini
    SI Lab 1 Zubcov Olga
    Ion Popescu
    Încă nu există evaluări
  • Rapot IOC
    Rapot IOC
    Document5 pagini
    Rapot IOC
    Ion Popescu
    Încă nu există evaluări
  • Indrumar TAP
    Indrumar TAP
    Document120 pagini
    Indrumar TAP
    Ion Popescu
    Încă nu există evaluări
  • Laboratorul nr.1
    Laboratorul nr.1
    Document1 pagină
    Laboratorul nr.1
    Ion Popescu
    Încă nu există evaluări