# Creating a Repository

First, let's create a new directory under our home directory for our work and then change the current working directory to the newly created one:

```
cd ~
mkdir practice_git
cd practicegit
```

\
Then we tell Git to make a repository for our practice\_git project. It is a place where Git can store versions of our files:

```
git init
```

It is important to note that git init will create a repository that can include subdirectories and their files—there is no need to create separate repositories nested within the practice\_git repository, whether subdirectories are present from the beginning or added later. Also, note that the creation of the practice\_git directory and its initialization as a repository are completely separate processes.

If we use ls to show the directory’s contents, it appears that nothing has changed:

```
ls
```

But if we add the -a flag to show everything, we can see that Git has created a hidden directory within practice\_git called .git:

```
ls -a
```

```
Output:

.            ..           .git
```

Git uses this special subdirectory to store all the information about the project, including the tracked files and sub-directories located within the project’s directory. If we ever delete the .git subdirectory, we will lose the project’s history.

Next, we will change the default branch to be called main. This might be the default branch depending on your settings and version of git. See the [setup episode](https://swcarpentry.github.io/git-novice/02-setup/index.html) for more information on this change.

Let' ask Git to tell us the status of our project:

```
git status
```

```
Output:

On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)
```

\
We do not like the branch name "master". Let's change it to main

```
git checkout -b main
```

Let's again ask Git to tell us the status of our project:

```
git status
```

```
Output:

On branch main

Initial commit

nothing to commit (create/copy files and use "git add" to track)
```

If you are using a different version of git, the exact wording of the output might be slightly different.


---

# Agent Instructions: 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://igb.mit.edu/mini-courses/version-control-with-git/creating-a-repository.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.
