Skip to content
CuriosoTechCuriosoCuriosoTech
ES

Git Tutorial from Scratch

Learn Git step by step: from installation to professional workflows with branches, merge, and collaboration.

C
CuriosoTech Team
2 min read
Git Tutorial from Scratch

Why Learning Git Is Essential for Every Developer

Git is the most widely used version control system in the world. It allows you to:

  • Save the complete history of your project
  • Work as a team without conflicts
  • Experiment with branches without affecting the main code
  • Revert changes when something goes wrong

How to Install and Configure Git on Windows, Mac, and Linux

# macOS
brew install git

# Ubuntu/Debian
sudo apt install git

# Windows
# Download from https://git-scm.com

Initial configuration:

git config --global user.name "Your Name"
git config --global user.email "you@email.com"

Essential Git Commands for Beginners

How to Create a Git Repository from Scratch

git init my-project
cd my-project

Git Add, Commit, and Log: The Basic Workflow Cycle

# Check file status
git status

# Add files to staging
git add file.js
git add .              # add all

# Create a commit
git commit -m "Description of the change"

# View history
git log --oneline

Branches in Git: Create, Switch, and Merge

# Create and switch to a new branch
git checkout -b feature/new-feature

# List branches
git branch

# Switch back to main
git checkout main

# Merge branch
git merge feature/new-feature

Professional Git Workflow: Pull Requests and Code Review

  1. Create a branch from main
  2. Make small, descriptive commits
  3. Open a Pull Request
  4. Code review
  5. Merge into main
  6. Delete the branch

Advanced Git Commands: Stash, Diff, Reset, and Blame

# Temporarily save changes
git stash
git stash pop

# View differences
git diff

# Undo last commit (keeping changes)
git reset --soft HEAD~1

# See who wrote each line
git blame file.js

Next Steps to Master Git and Version Control

Git is a fundamental tool for any developer. Mastering these basic commands will give you a solid foundation for collaborating on any project.

CuriosoTech Team

Equipo editorial de CuriosoTech. Apasionados por la tecnología y la educación accesible.

Share

Compartir:

Comments

0 / 2000