What is a repository?
A Git repository is a digital storage space where developers can store their source code and other related files, as well as track changes, and collaborate with other team members.
Components of Git repository
Here are some key components of a Git repository.
Working directory:
This is the directory on your computer where you keep your files, including the source code you want to manage with Git.
Index:
It's also known as the staging area, where you can prepare your changes before committing them to the repository. It allows us to selectively choose which changes we want to commit.
Commit:
It is a snapshot of the changes you have made to your files at a specific point in time. When we commit our changes, we create a new version of the code that can be easily tracked and managed.
Branches:
Git allows multiple developers to work on different parts of the codebase without interfering with each other's work by creating multiple branches.
Remote:
A remote repository is a copy of your repository stored on a remote server, such as GitHub, GitLab or Bitbucket, It allows you to share your code with other developers and collaborate on projects.
Creating a Repository in GitHub
A repository is a place where you can store and manage your code.
Here are the steps to create a repository on GitHub.
Log in to your GitHub account and click on the '+' button in the top right corner of the screen.
Select 'New repository' from the dropdown menu, then you will need to fulfil this information.
Repository name:
Choose a name that is descriptive and easy to remember.
Description:
Write a short description of your repository to help other developers understand what it is about.
Public or Private:
Choose your repository audience, if you want to show your repository to anyone you will choose Public otherwise private.
Initialize this repository with a README:
If you want to create a readme file for your repository, check this box. It is a text file that provides information about your project, such as installation instructions, usage guidelines, and contribution guidelines.
Once you have entered all the required information, click on the "Create repository" button. This will create a new repository on GitHub.
You can add files to your repository, create branches, and collaborate with other developers. To add files to your repository, you can either drag and drop them onto the repository page or use the command line interface(CLI) to push your files to the repository.