What are Git and GitHub and why are they essential if you want to work on open-source projects?

Let's start by defining what Git is. Git is a distributed version control system, which allows developers to track changes to their code over time.
Unlike centralised version control systems, Git has the feature of allowing each developer to have a complete copy of the repository, which facilitates offline work and collaboration between multiple developers.
To use it, it is essential that the developer knows and manages the seven main concepts of Git, which are presented below:
1. Repository (Repo): is a folder that Git tracks, it can contain code files, documentation, and more. Repositories can be located on your local machine or on a remote server.
2. Commit: This is a checkpoint in the development history, representing a set of changes made to the repository. Each commit includes a descriptive message explaining what changes were made and why.
3. Branch: allow developers to work on different versions of the project at the same time. For example, you can have a main branch (main or master) that contains the stable version of the code, and separate branches for new features or bug fixes.
4. Merge: when you merge one branch with another. For example, when you finish working on a new feature in one branch, you can merge it with the main branch.
5. Fork: a copy of a repository that you can modify without affecting the original repository. This is useful when you want to propose changes to a project without altering the original version until your changes are approved.
6. Pull Request (PR): A pull request is when you ask the project maintainer to review and accept the changes you have made to your fork or branch and integrate them into the original repository.
7. Clone: this means making a complete copy of that repository on your local machine.
Now let's talk about the web-based platform that uses Git for version control and offers a user-friendly interface for collaboration on software projects, GitHub.
GitHub has key functions such as allowing developers to host their repositories, collaborate with others on projects, perform code reviews, and manage development-related tasks.
Let's take a look at the main features of the GitHub platform:
1. Public and Private Repositories: GitHub allows you to create public repositories (visible to anyone) or private repositories (only accessible to authorised users).
2. Issues and Projects: GitHub includes tools for managing tasks and bugs (issues) and for organising work in project boards (projects), similar to Trello.
3. Code Reviews: Pull requests on GitHub allow developers to review, comment and discuss proposed changes before merging them into the main code.
4. GitHub Actions: This functionality allows you to automate workflows, such as running automated tests or deploying code to production.
5. GitHub Pages: Allows you to host websites directly from a GitHub repository, which is useful for project documentation or personal sites.
If you've already decided to learn how to use Git and GitHub, we'll show you how to start using them in short and easy steps:
1. Install Git on your local machine: Git is a command-line tool that you can install on any operating system. You can download it from https://git-scm.com/
2. Create a GitHub account: Sign up at https://github.com/ to create a free account. This will allow you to host repositories and collaborate on other people's projects.
3. Configure Git on your machine: Open the terminal (or Git Bash on Windows) and configure your username and email address:
git config --global user.name "Your Name"
git config --global user.email "tuemail@example.com"
4. Clone a Repository: To work on an existing project, clone the repository to your local machine, this will create a copy of the repository on your machine:
git clone https://github.com/usuario/proyecto.git
5. Make Changes and Commi: Navigate to the project directory, make changes to the files, and use the following commands to save them:
git add .
git commit -m "Description of changes"
6. Create a New Branch: It is advisable to work on a new branch so as not to alter the main branch:
git checkout -b name-of-branch
7. Push Your Changes to GitHub: Once you've made commits, you can push your changes to GitHub:
git push origin branch-name
8. Create a Pull Request on GitHub: Go to the repository on GitHub and you'll see an option to create a pull request from your new branch. This starts the process of reviewing your code.
9. Participate in Code Review: Other contributors can review and comment on your pull request. Take suggestions, make adjustments if necessary, and once approved, your code can be merged into the main branch.
10. Explore and Contribute: Search for interesting projects on GitHub using tags like "Good First Issue" or explore the repositories of organizations like Mozilla, Google, or Facebook to get started.
Remember, by mastering Git and GitHub, you equip yourself with essential tools that are not only essential for working on open-source projects but are also widely used in professional environments.
For more information, here are some additional resources for you to continue your learning:
Pro Git (Free Book): A comprehensive book on Git that covers everything from basic to advanced concepts. Available online at git-scm.com/book/en/v2
GitHub Learning Lab: GitHub offers a series of interactive tutorials for learning Git and GitHub at lab.github.com
Try Git: An interactive short course to learn the basics of Git at try.github.io


