From 8a82253fc27cc35c6bd73da372fbd15d93c2cac0 Mon Sep 17 00:00:00 2001 From: Bjarke Sporring Date: Thu, 15 Jan 2026 14:22:11 +0100 Subject: [PATCH] fix: add better explanation of merges --- .../03-branching-and-merging/README.md | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/01-essentials/03-branching-and-merging/README.md b/01-essentials/03-branching-and-merging/README.md index 18c8f97..633ace7 100644 --- a/01-essentials/03-branching-and-merging/README.md +++ b/01-essentials/03-branching-and-merging/README.md @@ -78,36 +78,15 @@ git show Now practice creating your own branch: -```pwsh -# Create and switch to a new branch -git switch -c my-feature - -# Verify you're on the new branch -git branch -``` - -The `*` shows which branch you're currently on. +1. Create a new branch with the name `my-feature` using `git switch -c my-feature` +2. Check which branch you're on with `git branch`. The `*` shows which branch you're currently on. ### Part 3: Make Commits on Your Branch -Add some changes to your branch: - -Create or edit a file then add and commit -```pwsh -# Create a new file or modify an existing one. -# Stage and commit -git status # see the files that are untracked or changed -git add . -git commit -m "Add my feature" - -# Create or edit another file -# Make another commit -git status # see the files that are untracked or changed -git add . -git commit -m "Expand feature documentation" - -git log --oneline --graph --all # see how your branch is moving forward from main -``` +1. Create a new file called `DOCS.md` and add some content. What doesn't matter, just something. +2. Add and commit the `DOCS.md` file (use the commands from `01-basics` module). +3. Add some more content to the `DOCS.md` file, add and commit the changes. +4. Now check how the tree is looking with `git log --oneline --graph --all` **Important:** Changes on your branch don't affect main! @@ -117,7 +96,7 @@ git log --oneline --graph --all # see how your branch is moving forward from mai - This way we create diverging branches. The `main` branch has changes as well as your new `my-feature` branch. - Run `git log --oneline --graph --all` to see how the tree is looking 4. Switch back to your branch `git switch my-feature` -5. The changes from the `main` branch are now gone. Check the changes you committed before. You'll notive they're back! +5. The changes from the `main` branch are now gone. Check the changes you committed before. You'll notice they're back! ### Part 4: Merge Your Branch