use switch instead of checkout for branches
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user