Git Basic Concepts

In this workshop we are going to talk about git and how that tool help us to develop software collaboratively, and keep our code safe when we are working with others.

DELIVERABLE

At the end of this workshop you have to present a report on the README file in which you show the execution of each step presented as follows

The Report has to be presented on Github in the repository that you are going to create when the workshop has been finished. Don´t forget to include the code too.

Setup

Download git using the following urls

Creating a local repository

Git init

Let's code

Character

Frequency: anagram

Frequency: margana

A or a

3

3

G or g

1

1

N or n

1

1

M or m

1

1

R or r

1

1

Character

Frequency: anagramm

Frequency: marganaa

A or a

3

4

G or g

1

1

N or n

1

1

M or m

2

1

R or r

1

1

Character

Frequency: Hello

Frequency: hello

E or e

1

1

H or h

1

1

L or l

2

2

O or o

1

1

Preserving our changes

Use the following command

git add .

Use the command line to type the command showed below

git commit -m "Message"

Now we have our code in our local git repository, but it is not present in any remote repository that can be accessed by our teammates

Using Github

Go to github

If you do not have a github account create it, cause you are going to need it.

Create a new repository on github and name it workshop1

Copy the url of your remote repository, in order to link it with our local repository that was created previously

Use the following command to link the remote repository with the local one.

git remote add origin <server>

Using the push command

Using the command line, type the command below

git push origin master

Cloning our repository

In other folder or machine use the following command in order to clone the remote repository created above.

git clone <repository>

Let's code

Preserve the changes using your partner's github account.

Using pull command

Use the first github account to type this command

git pull origin master

Include the report on github repository using the commands you have learned

If you want more information about git you can find it at http://rogerdudler.github.io/git-guide/

Last updated

Was this helpful?