gitpractice.dev

brewly — Ch.2 · Started on the wrong branch

Exercise 4 of 7

Before you start

Uncommitted changes travel with you

Changes you have not committed belong to your folder, not to a branch. Creating a new branch keeps them, so you can still commit them in the right place.

git status
which branch am I on, and what changed?
git switch -c <name>
create a branch; your changes come along
git add <file>
stage a file
git commit -m "What you did"
commit it on the new branch
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path