Skip to main content
This guide covers the Git workflow used for TechCore Mini ERP development, from initial setup to collaborating with remote repositories.

Initial Configuration

Before you begin working with Git, configure your identity globally (only needed once).
1

Set your username

git config --global user.name "Tu Nombre"
This establishes your name for all commits.
2

Set your email

git config --global user.email "tu@email.com"
This defines your email address for commits.
3

Verify configuration

git config --list
Review your current Git configuration.

Basic Local Commands

These commands help you manage a local repository.
1

Initialize repository

git init
Creates a Git repository in the current folder.
2

Check status

git status
Shows the state of modified, staged, or untracked files.
3

Stage changes

git add <archivo>
# or stage all changes
git add .
Adds changes to the staging area.
4

Commit changes

git commit -m "Mensaje descriptivo"
Saves changes with a descriptive message.
5

View history

git log
# or compact view
git log --oneline
Views the commit history.

SSH Setup for Remote Repositories

SSH provides secure authentication without passwords. Keys are generated in ~/.ssh (use Git Bash on Windows).
1

Generate SSH key pair

ssh-keygen -t rsa -b 4096 -C "tu@email.com"
Press Enter for default path and no initial passphrase.
2

Start SSH agent

eval $(ssh-agent -s)
Initializes the SSH agent.
3

Add private key

ssh-add ~/.ssh/id_rsa
Adds your private key to the agent.
4

Copy public key

cat ~/.ssh/id_rsa.pub
Copy the output and add it to GitHub (Settings > SSH keys).
5

Test connection

ssh -T git@github.com
Should display “Hi username!” if successful.

Working with Remote Repositories

Connect with remote repositories using SSH URLs (e.g., git@github.com:usuario/repo.git).

Cloning and Adding Remotes

1

Clone a repository

git clone <URL-SSH>
Copies a remote repository to your local machine.
2

Add a remote

git remote add origin <URL-SSH>
Links your local repository to a remote.
3

List remotes

git remote -v
Shows configured remote repositories.

Branch Management

Branches enable parallel development workflows, such as feature branches.

Basic Branch Operations

# List local branches
git branch

# Create a new branch
git branch <nombre-rama>

# Switch to a branch
git checkout <rama>
# or using newer syntax
git switch <rama>

# Create and switch to a new branch
git checkout -b <rama>

# Merge changes from another branch
git merge <rama>

Synchronizing with Remotes

Use SSH for secure push operations.

Push and Pull Commands

# Push commits to remote
git push origin <rama>

# Pull and merge remote changes
git pull origin <rama>

# Initial push with tracking
git push -u origin <rama>

# Delete remote branch
git push origin --delete <rama>

Best Practices

  • Write clear, descriptive commit messages
  • Commit frequently with logical units of work
  • Always pull before pushing to avoid conflicts
  • Use feature branches for new development
  • Keep the main/master branch stable
  • Review changes with git status and git diff before committing

Build docs developers (and LLMs) love