๐Ÿš€Day 8 Task: Basic Git & GitHub for DevOps Engineers.

ยท

6 min read


๐Ÿ“ŒWhat is Git?

Git is a version control system (VCS) that allows you to track changes, collaborate with others, and manage your software development projects efficiently. It's like a time machine for your code, helping you keep track of every modification made to your files, whether they're text documents, code files, or any other digital content. It is commonly used for software development.

With Git, you can keep a record of who made changes to what part of a file, and you can revert back to earlier versions of the file if needed. Git also makes it easy to collaborate with others, as you can share changes and merge the changes made by different people into a single version of a file.


๐Ÿ“ŒWhat is GitHub ๐Ÿ˜ธ?

GitHub is a web-based platform that provides hosting for version control using Git. It is a subsidiary of Microsoft, and it offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It's a place where developers can collaborate on software projects, share code, contribute to open-source projects, and manage their development workflows. Think of it as a social network for developers and a central hub for code collaboration.

Here's what GitHub offers:

  1. Git Hosting: GitHub hosts Git repositories, which are like organized folders that contain your project's files, history, and changes. This makes it easy for you to store your code and collaborate with others.

  2. Collaboration: GitHub allows multiple developers to work together on the same project. You can contribute to others' projects, request changes (pull requests), and review code changes made by others.

  3. Issue Tracking: You can create and track issues for your project. Issues can represent bugs, feature requests, or tasks that need to be completed. This helps in organizing and prioritizing work.

  4. Wikis and Documentation: GitHub provides tools for creating wikis and documentation for your projects. This is helpful for explaining how your code works and providing information to users and contributors.

  5. Integration with CI/CD: Continuous Integration (CI) and Continuous Deployment (CD) tools can be integrated with GitHub. This means your code can be automatically tested, built, and deployed whenever you make changes.

  6. Open Source Contributions: Many open-source projects are hosted on GitHub. This makes it easy for developers to contribute to projects they're interested in by submitting pull requests.

  7. Visibility and Discovery: GitHub makes your projects accessible to a broader audience. Other developers can discover your work, learn from your code, and even contribute to it.

  8. GitHub Pages: You can use GitHub to host static websites for your projects, documentation, or personal blogs using GitHub Pages.


๐Ÿ“ŒWhat is Version Control? How many types of version controls do we have?

Version control is a system that tracks changes to a file or set of files over time so that you can recall specific versions later. It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.

There are two main types of version control systems: centralized version control systems and distributed version control systems.

  1. A centralized version control system (CVCS) uses a central server to store all the versions of a project's files. Developers "check out" files from the central server, make changes, and then "check-in" the updated files. Examples of CVCS include Subversion and Perforce.

A distributed version control system (DVCS) allows developers to "clone" an entire repository, including the entire version history of the project. This means that they have a complete local copy of the repository, including all branches and past versions. Developers can work independently and then later merge their changes back into the main repository. Examples of DVCS include Git, Mercurial, and Darcs.


๐Ÿ“ŒWhy do we use distributed version control over centralized version control?

  1. Better collaboration: In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don't have to constantly communicate with a central server to commit their changes or to see the changes made by others.

  2. Improved speed: Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don't have to communicate with a central server.

  3. Greater flexibility: With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.

  4. Enhanced security: In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to data loss. If the central server in a CVCS goes down or the repository becomes corrupted, it can be difficult to recover the lost data.

Overall, the decentralized nature of a DVCS allows for greater collaboration, flexibility, and security, making it a popular choice for many teams.


๐Ÿ“Task

๐Ÿ‘‰๐Ÿผ Install Git on your computer.

You can download it from the official website at https://git-scm.com/downloads

๐Ÿ‘‰๐Ÿผ Create a free account on GitHub.

You can sign up at https://github.com/


๐Ÿ“šExcercises

๐Ÿ‘‰๐Ÿผ Create a new repository on GitHub and clone it to your local machine

Step 1 -> Login to your GitHub account.

Step 2 -> Click on new after clicking you get a new page there you give your repository name and make your repo public / private and click on create.

Step 3 -> Open that repository page newly created go to code and select HTTPS URL

Step 4 -> In your local simply write your cmd. git clone URL

๐Ÿ‘‰๐Ÿผ Make some changes to a file in the repository and commit them to the repository using Git.

Step 1 -> Update your file.

Step 2 -> Use the command to add a file on GIT git add <file_name>

Step 3 -> Use the command to commit a file on GIT git commit -m "message"

๐Ÿ‘‰๐Ÿผ Push the changes back to the repository on GitHub

Use the command push git push origin <branch_name>


๐ŸŒŸ Conclusion:

Congratulations! ๐ŸŽ‰

Git is an essential tool โš™๏ธ for developers ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ปto manage their code, collaborate effectively, and maintain a detailed record of their project's development history. It's widely used across the software industry and has become a standard tool for version control and collaborative coding.

GitHub ๐Ÿ˜ธ is a web-based platform where developers can collaborate, contribute, and showcase their coding skills.

We hope this blog has given you a Question/Answer ๐Ÿš€๐Ÿ’ช

๐Ÿ” Did you find this blog helpful? Let us know in the comments below! ๐Ÿ‘‡ And if you have any questions or need further assistance, we're here to help! ๐Ÿค—

Happy Learning! ๐Ÿ’ปโœจ

ย