Table of contents
- ✔️ What is Git?
- ✔️What is GitHub?
- ✔️What is Version Control?
- ✔️How many types of version controls we have?
- ✔️Difference between Centralized and Distributed version control System.
- ✔️Why we use distributed version control over centralized version control?
- ✔️Install Git on your computer :
- ✔️Create an account on GitHub :
- ✔️You need to know some basic commands of git :
- ✔️Create a new repository on GitHub and clone it to your local machine :
- ✔️Clone the repository to your local machine :
- ✔️Make some changes to a file in the repository and commit them to the repository using Git :
✔️ What is Git?
Git is a version control system that helps track changes in files and projects, making it easier for multiple people to collaborate on the same codebase. It allows you to save different versions of your work, switch between them, and merge changes made by different contributors. Git is widely used in software development for its efficiency and ability to handle complex projects.
✔️What is GitHub?
GitHub is a web-based platform that uses Git for version control. It provides a place for developers to store and collaborate on their code repositories. GitHub offers features like issue tracking, pull requests, and project management tools, making it easier for teams to work together and contribute to open-source projects. It also allows for easy sharing and discovery of code.
✔️What is Version Control?
Version control is a system that manages changes to files over time. It helps track and organize different versions of a project, allowing you to revert back to previous states if needed. It enables collaboration among multiple developers by providing a central repository where changes can be shared and merged. Version control also helps in tracking who made specific changes, facilitating accountability and teamwork. It is an essential tool in software development for maintaining code quality and enabling efficient collaboration.
✔️How many types of version controls we have?
Centralized Version Control Systems (CVCS): These systems have a central server that stores the entire history and files of a project. Developers can check out a copy of the project, make changes, and then commit them back to the central server.
Distributed Version Control Systems (DVCS): In DVCS, every developer has a complete copy of the project's history and files on their local machine. This allows for more flexibility and offline work, as developers can commit changes locally and later synchronize them with others.
Hybrid Version Control Systems: Some version control systems combine elements of both centralized and distributed systems. They provide a central repository but also allow developers to have their own local copies and work offline, merging changes with the central server when connected.
✔️Difference between Centralized and Distributed version control System.
Centralized VCS | Distributed VCS |
Has a central server that stores the repository | Each developer has a complete copy of the repository |
Requires network connectivity for most operations | Requires network connectivity for most operations |
Developers check out files from the central server | Developers have their own local repository |
Changes are committed directly to the central server | Changes can be committed locally and later synchronized |
Limited branching and merging capabilities | Flexible branching and merging, enabling parallel development |
Relies on the central server for history and backups | Each developer's local repository serves as a backup |
Examples: CVS, Subversion (SVN) | Examples: Git, Mercurial |
✔️Why we use distributed version control over centralized version control?
Distributed version control offers several advantages over centralized version control:
Offline Work: With DVCS, developers can work offline and commit changes to their local repository. This allows for uninterrupted productivity even when internet connectivity is unavailable.
Flexibility and Independence: Each developer has their own complete copy of the repository, enabling them to experiment, create branches, and make changes independently without affecting others. This promotes flexibility and encourages parallel development.
Faster Operations: DVCS operations like committing changes, branching, and merging are typically faster because they are performed locally without the need to communicate with a central server.
Redundancy and Backups: Each developer's local repository acts as a backup, reducing the risk of data loss. In case of a central server failure, the distributed nature ensures that others still have access to the complete history.
Collaboration and Forking: DVCS platforms like Git facilitate easy collaboration by allowing developers to clone and contribute to projects hosted by others. Forking, where developers create their own independent copies of a project, encourages innovation and experimentation.
Decentralized Development: Distributed version control systems support distributed teams and decentralized workflows. Contributors can work on different aspects of a project independently and later merge their changes, making it easier to manage complex projects with multiple contributors spread across different locations.
here an image to differentiate them:
✔️Install Git on your computer :
download git from git-scm.com/downloads and install it.
✔️Create an account on GitHub :
Go to the GitHub website: Open your web browser and navigate to github.com.
Sign Up: On the GitHub homepage, you'll find a "Sign Up" button. Click on it to start the registration process.
Provide your information: Fill in the required information in the registration form, including your username, email address, and password. Choose a strong password to secure your account.
Choose a plan: GitHub offers both free and paid plans. Select the plan that suits your needs. If you're just getting started, the free plan is usually sufficient.
Complete the setup: After choosing a plan, you may be asked to provide additional information, such as your role or areas of interest. Fill in the requested details and proceed.
Verify your email: GitHub will send you a verification email to the address you provided during registration. Open the email and click on the verification link to confirm your email address.
Explore GitHub: Once your account is verified, you can start exploring GitHub's features, repositories, and communities. You can create your own repositories.
That's it! You have successfully created your GitHub account.
✔️You need to know some basic commands of git :
Command | Description |
| Initializes a new Git repository in the current directory. |
| Creates a local copy of a remote repository. |
| Adds changes or new files to the staging area for the next commit. |
| Records changes to the repository with a commit message. |
| Shows the status of the working directory and staging area. |
| uploads local commits to a remote repository. |
| Fetches and merges changes from a remote repository. |
| Lists, creates, or deletes branches in the repository. |
| Switches to a different branch or restores files from a commit. |
| Combines changes from one branch into another branch. |
| Displays a history of commits in the repository. |
| Manages remote repositories linked to the local repository. |
✔️Create a new repository on GitHub and clone it to your local machine :
step 1: Sign in to your GitHub account using your username and password.
step 2: Once you are signed in, click on the "+" icon in the top-right corner of the GitHub homepage. From the dropdown menu, select "New repository."
or, go to repositories and click on 'new' in the top right corner.
or, click on green 'new' button
step 3: Set up the repository: On the new repository creation page, you need to provide some information:
Then click on 'create repository'
you have successfully created a repository.
step 4: After creating the Repository it will look something like this :
✔️Clone the repository to your local machine :
step1: click on <>code, after that, we can see a path, and copy that path
step 2: lets go into your local machine .
step 3: git clone <paste_the_copied_link_here>
it will clone your repository into your local
step 4: type
ls
to confirm , see my 'mobile' repo is here✔️Make some changes to a file in the repository and commit them to the repository using Git :
step 1: Go to your cloned folder, in my case I use
cd mobile
step 2: let's check the git status using
git status
step 3: Now, stage it using the command
git add .
and checkgit status
step 4: Now, commit the changes you using git commit -m " your message"
step 5: push it to the repository using
git push origin
files are adeed sucessfully into the repository.
Thank you so much for reading.
Follow me on LinkedIn to see interesting posts like this : )
linkedin.com/in/prabir-kumar-mahatha-6a0025..
visit my git hub profile : https://github.com/PrabirKumarMahatha