> For the complete documentation index, see [llms.txt](https://eci.gitbook.io/workshops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eci.gitbook.io/workshops/basic-concepts/git-basic-concepts.md).

# Git Basic Concepts

## 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

{% tabs %}
{% tab title="IOS" %}
<http://git-scm.com/download/mac>
{% endtab %}

{% tab title="WINDOWS" %}
<https://gitforwindows.org/>
{% endtab %}

{% tab title="LINUX" %}
<http://git-scm.com/book/en/Getting-Started-Installing-Git>
{% endtab %}
{% endtabs %}

### Creating a local repository

* [x] Create a folder
* [x] Using the command line to  go to the folder created in the previous step.
* [x] Use the following command to create a new local repository

```
Git init
```

### Let's  code

* [x] Using your favorite IDE, create a new java project using the folder you have created previously as Workspace
* [x] Solve the following problem using java

{% hint style="info" %}
Two strings, and , are called anagrams if they contain all the same characters in the same frequencies. For example, the anagrams of `CAT` are `CAT`, `ACT`, `TAC`, `TCA`, `ATC`, and `CTA`.

Complete the function in the editor. If and are case-insensitive anagrams, print "Anagrams"; otherwise, print "Not Anagrams" instead.

**Input Format**

The first line contains a string denoting .\
The second line contains a string denoting .

**Constraints**

* * Strings  and  consist of English alphabetic characters.
* The comparison should NOT be case sensitive.

**Output Format**

Print "Anagrams" if and are case-insensitive anagrams of each other; otherwise, print "Not Anagrams" instead.

**Sample Input 0**

```
anagram
margana
```

**Sample Output 0**

```
Anagrams
```

**Explanation 0**
{% endhint %}

| 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                    |

{% hint style="info" %}
The two strings contain all the same letters in the same frequencies, so we print "Anagrams".

**Sample Input 1**

```
anagramm
marganaa
```

**Sample Output 1**

```
Not Anagrams
```

**Explanation 1**
{% endhint %}

| 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                     |

{% hint style="info" %}
The two strings don't contain the same number of `a`'s and `m`'s, so we print "Not Anagrams".

**Sample Input 2**

```
Hello
hello
```

**Sample Output 2**

```
Anagrams
```

**Explanation 2**
{% endhint %}

| 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                  |

{% hint style="info" %}
The two strings contain all the same letters in the same frequencies, so we print "Anagrams".

Taken from: <https://www.hackerrank.com/challenges/java-anagrams/problem>
{% endhint %}

### Preserving our changes

Use the following command

```
git add .
```

{% hint style="info" %}
Answer: What is the purpose of this command?
{% endhint %}

Use the command line to type the command showed below

```
git commit -m "Message"
```

{% hint style="info" %}
Answer : Why we used it?
{% endhint %}

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](https://github.com/)

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
```

{% hint style="info" %}
Answer: What is the purpose of the this command?
{% endhint %}

### Cloning our repository

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

```
git clone <repository>
```

{% hint style="info" %}
Answer: What is the purpose of this command?
{% endhint %}

### Let's code

{% hint style="info" %}
The challenge here is to read n lines of input until you reach *EOF*, then number and print all lines of content.

**Hint:** Java's *Scanner.hasNext()* method is helpful for this problem.

**Input Format**

Read some unknown n lines of input from *stdin(System.in)* until you reach *EOF*; each line of input contains a non-empty *String*.

**Output Format**

For each line, print the line number, followed by a single space, and then the line content received as input.

**Sample Input**

```
Hello world
I am a file
Read me until end-of-file.
```

**Sample Output**

```
1 Hello world
2 I am a file
3 Read me until end-of-file.
```

taken from <https://www.hackerrank.com/challenges/java-end-of-file/problem>
{% endhint %}

Preserve the changes using your partner's github account.

{% hint style="info" %}
Take a screenshot of the commit report in the github account and include it in the report
{% endhint %}

### Using pull command

Use the first github account to type this command

```
git pull origin master
```

{% hint style="info" %}
Answer: What that command does?
{% endhint %}

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

{% hint style="success" %}
If you want more information about git you can find it at <http://rogerdudler.github.io/git-guide/>
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eci.gitbook.io/workshops/basic-concepts/git-basic-concepts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
