use switch instead of checkout for branches

This commit is contained in:
Bjarke Sporring
2026-01-07 21:37:21 +01:00
parent 6b0e84934a
commit 7fb84560f5
2 changed files with 7 additions and 7 deletions

View File

@@ -43,12 +43,12 @@ Your goal is to create a feature branch, make commits on it, and understand how
5. Stage and commit: `git add login.py` and `git commit -m "Add login functionality"`
6. Modify `login.py`, then commit again
7. Switch back to main: `git switch main`
8. Run `ls` and notice that `login.py` doesn't exist on main!
8. Run `ls` (or check your file explorer) and notice that `login.py` doesn't exist on main!
9. Switch back to feature-login: `git switch feature-login`
10. Run `ls` again and see that `login.py` is back!
10. Run `ls` (or check your file explorer) again and see that `login.py` is back!
> **Important Notes:**
> - Use `git switch` to change branches (modern Git command)
> - Use `git switch` to change branches
> - `git switch -c <name>` creates and switches in one command
> - Branches are independent - files in one branch don't affect another until you merge
> - You can switch between branches as many times as you want