Skip to main content
Go back

Flujo de trabajo intermedio con Git

#git

Once you master commit and push, it’s time to upgrade your workflow to handle branches, temporary changes, and history reviews.

1. Branch Management (Modern vs Classic)

Creating and switching branches is essential to keep main clean.

bash
git switch -c feature/new-feature   # Create and switch
git switch main                     # Return to main

2. Temporary Storage (Stash)

Have halfway changes but need to switch branches urgently? Don’t commit broken code, put it in your “pocket”.

bash
git stash                   # Save changes and clean directory
git stash pop               # Recover latest saved changes
git stash list              # List all stashed changes

3. Readable History

Viewing the default history log can be overwhelming.

bash
git log --oneline --graph --all  # Compact visual tree

4. Undoing Changes

bash
git restore file.txt           # Discard local changes
git restore --staged file.txt  # Unstage changes