Rullst AcademyRullst Academy/Lesson
Git: every change counts · Lesson 06 / 10

An idea on another branch

A branch lets you develop an idea without immediately moving the main line. It is a reference to commits, not a separate folder.

Learning paths14 min

Let's discover together

  1. 1

    Start with clean git status. git switch -c melhoria creates the branch and switches to it. git branch --show-current confirms where new commits will be recorded.

  2. 2

    Create tips.txt containing Check status before commit. Save, stage only tips.txt and commit as Add tip. Files still need saving and staging on another branch.

  3. 3

    Return with git switch main. Until main includes the new commit, tips.txt disappears from the working tree because it does not exist in that version. The commit remains available on melhoria.

  4. 4

    git merge --ff-only melhoria only advances main to a descendant without creating a merge commit. If histories diverged, it refuses; do not force around that. Next lesson explores a conflicting merge.

GIT · .md

Your change laboratory

This page’s experiments show prepared outputs. To run real commands, use a new practice folder on your computer and the guide included in “Download activity”. Read the instructions before each command.

My files and GitHub

The editor below saves your Markdown notes in this browser. Download a copy to take them to another device. Sending that file to GitHub does not send your computer’s .git history.

FROM LESSON TO PRACTICE

A guide to follow at your pace

Read the steps before using the reference below. Commands run in the indicated system’s terminal; signup happens on the official site. Rullst Academy exercises are practice and do not verify your installation or external account.

git status
git switch -c melhoria
# Create and save tips.txt in your editor before continuing.
git add tips.txt
git commit -m "Add tip"
git switch main
git merge --ff-only melhoria
git log --oneline --graph --all

Official links and next step

✦
YOUR MISSION

Create, switch and integrate a branch with fast-forward.

Now it's your turn

Discovery workshop

Read the state, choose the next step

In the first scenario, the workshop has already switched to melhoria with git switch -c melhoria. In the second, the tips.txt change has been committed, we returned to main and completed git merge --ff-only melhoria. The query command is identical; the current branch changed. Prepared outputs; this page switches no real branches.
Mini experiment

Learning simulation: compare cards and check your predictions. The browser is not compiling Rust or starting a server.

git branch --show-current
Build your answers and check when you are ready.
A moment to understand

Why can --ff-only refuse?

I need a hint

Fast-forward is possible when the destination tip is an ancestor of the source.

Loading your journey…

Take it with you

Follow the steps in a clean workshop. Inspect tips.txt before and after switching. Draw commits and the two branch names; explain what advanced during merge.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.