fix: add better explanation of merges

This commit is contained in:
Bjarke Sporring
2026-01-15 14:22:11 +01:00
parent f0522e14bc
commit 8a82253fc2

View File

@@ -78,36 +78,15 @@ git show <merge-commit-hash>
Now practice creating your own branch: Now practice creating your own branch:
```pwsh 1. Create a new branch with the name `my-feature` using `git switch -c my-feature`
# Create and switch to a new branch 2. Check which branch you're on with `git branch`. The `*` shows which branch you're currently on.
git switch -c my-feature
# Verify you're on the new branch
git branch
```
The `*` shows which branch you're currently on.
### Part 3: Make Commits on Your Branch ### Part 3: Make Commits on Your Branch
Add some changes to your branch: 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).
Create or edit a file then add and commit 3. Add some more content to the `DOCS.md` file, add and commit the changes.
```pwsh 4. Now check how the tree is looking with `git log --oneline --graph --all`
# 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
```
**Important:** Changes on your branch don't affect main! **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. - 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 - Run `git log --oneline --graph --all` to see how the tree is looking
4. Switch back to your branch `git switch my-feature` 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 ### Part 4: Merge Your Branch