Setting up Git for the first time

- Andrés Cruz

En español

If you're a software developer, you've probably heard of version control. This practice is essential for managing changes to your code over time. One of the most popular version control systems is Git, widely used by developers around the world. In this guide, we'll explore how to set up Git for the first time and some tips to get the most out of it.

Git is a fundamental tool when developing our applications, any package today that you want to use or any project that you want to see as a reference probably uses Git to manage its versions and is hosted in a repository on the Internet such as GitHub.

What is Version Control?

Version control is the management of changes to documents, files, or any other type of data. In software development, it is essential to track and manage code changes, ensure code quality, reduce errors, and improve collaboration between team members. Without version control, managing and tracking code changes would be a difficult and error-prone task.

What is Git?

Git is a version control system widely used by developers to manage changes in the code, as we mentioned before, it is widely used with github or similar, since in this way we can have a reference and order when developing our projects, that if we did some development two years ago and we want to review something, we can perfectly see the history in git or do a checkout at the time that change was made to our project and review the change.

In short, git is your best ally for developing applications, there are countless reasons to use it whether you develop in a team or alone, you should always have a copy of your work and log and that is what git is for and much more.

Git Initial Setup

1. Download Git

To get started, download Git from the official Git site. Choose the appropriate version for your operating system.

2. Install Git

Follow the installation instructions for your operating system, but you can go to the official Git page and see what the options are depending on your operating system, usually it is either a console command or simply running an executable.

Once installed, verify that Git is available on the command line by running:

git --version

It should return a number that indicates the version of git installed on your computer.

3. Set your Name and Email

Set your name and email address so Git can identify your changes correctly:

git config --global "Your Name"

git config --global ""

This is essential if you later want to use a system like github to store your work.

4. Create a Repository

Finally, with the previous steps you can now use git, the first thing we do is initialize a project, whether it is empty or not, there are no excuses to start a new project in git.

  • New Repository:
    • Create a folder for your project and run:

      git init
  • Clone Existing Repository:
    • Run:

      git clone <URL del Repositorio>

Basic Git Commands

Git has an infinite number of commands that you can use, but among the main ones we have the following:

  • git add <file>: Add changes to the staging area.
  • git commit -m "Commit Message": Make a commit with a descriptive message.
  • git push: Push changes to the remote repository.
  • git pull: Get changes from the remote repository.

Good Practices with Git

  • Atomic Commits: Make small, specific commits.
  • Write Descriptive Messages: Clearly describe the changes made in each commit.
  • Use Branches: Create branches for new features and fix bugs in the main branch.
  • Collaborate: Work with other developers and use tools like GitHub or GitLab.
Andrés Cruz

Desarrollo con Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz en Udemy

Acepto recibir anuncios de interes sobre este Blog.