gitpractice.dev

brewly — Ch.2 · Keep junk out of git

Exercise 7 of 7

Before you start

What does not belong in a repository

Logs, build output, installed packages and secrets should never be committed. A file named .gitignore lists patterns for git to skip.

One pattern per line. notes.txt matches that file, *.tmp matches every file ending in .tmp, and build/ matches a whole folder.

Be precise: a pattern that is too broad also hides real work. Commit .gitignore so the whole team benefits.

git status
ignored files no longer show up here
git add .
stage everything that is not ignored
git commit -m "What you did"
commit it
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