/    /  Git – Repository

Git Repository 

 

Git repositories are virtual storage spaces where all the files, directories, and history of a project is stored. They are local representations of projects and contain all the information about the project, including its code, its history, and its metadata.

A Git repository has the following components:

The working directory: This is the top-level directory of the project, and it contains all the files and directories.

The index: It is a temporary staging area where changes to the working directory are prepared before being committed.

The repository: The repository is the hidden directory where Git stores all the information about the project, including the history of the project and all the metadata.

A Git repository can be created by using the “git init” command, which initializes a new Git repository in the current directory. Once the repository is created, developers can add and modify files in the working directory, stage the changes in the index, and commit those changes to the repository.

Creating a Repo :

You will need to create a repository for your project on GitHub.

1. Select New repository from the drop-down menu on any page.

2.Give your repository a short, memorable name, such as “hello-world”.

Git Repository

 3.Add a description of your repository. For example, “My first repository on GitHub.”.

Git Repository

4.For more information, see “About repositories”.

Git Repository

5.Add a README to this repository.

Git Repository

6.Then click Create repository.

Git Repository

Your first repository has been created and a README file has been added. Congratulations!

Commit your first change

You can think of a commit as a snapshot of all the files in your project at a specific point in time.

Upon creating your new repository, you added a README file. You can use a README file to describe your project in more detail, or to add some documentation about how to install or use your project. On the front page of your repository, the contents of your README file appear automatically.

Let’s make a change to the README file.

1. Click README.md in the list of files in your repository.

repo

2.Over the file’s content, click.

3.Type some information about yourself on the Edit file tab.

Git Repository

4.Click Preview changes above the new content.

Git Repository

5.You will see the new content in green after reviewing the changes you made.

Git Repository

6.Type a short, meaningful commit message that describes the change you made to the file. You can attribute the commit to more than one author. message.  

Git Repository

7.If your current branch is the default branch, you should create a new branch for your commit and then create a pull request from this branch. 

Git Repository

8.Then click Propose file changes.

Git Repository

Next steps

A repository, including a README file, has now been created on GitHub.com, and your first commit has been made.

  • GitHub now provides the ability to clone a repository so you can create a local copy of it on your computer. From your local repository, you can commit and create a pull request to update the upstream repository. 
  • Making changes to GitHub projects and repositories is as simple as forking them. A fork allows you to make changes to another repository without affecting the original.
  • By connecting and following people, repositories, and organizations on GitHub, you can interact with them.