CodeBlanks Logo Icon CodeBlanks

Commit flow

Add multiple files and create commits with meaningful messages.

Work with Multiple Files

You can modify multiple files in a project. You can use git add with multiple filenames to prepare them for the same commit.

git add index.html style.css

Saving the prepared changes under one meaningful commit helps keep your project history organized.

Practice Prepare Two Files Together

Prepare index.html and style.css for the same commit. Then print a message confirming preparation is complete.

Starter code

terminal
print("Dosyalar kontrol edildi")

Sample solution

terminal
git add index.html style.css
print("İki dosya hazırlandı")

Expected output

Dosyalar kontrol edildi
İki dosya hazırlandı

Practice Create Meaningful Commit Messages

First add index.html and create a commit with the message Homepage added. Then add style.css and create a second commit with the message Page styles added.

Starter code

terminal
print("İlk kayıt hazırlanıyor")

Sample solution

terminal
git add index.html
git commit -m "Ana sayfa eklendi"
git add style.css
git commit -m "Sayfa stilleri eklendi"
print("İki commit tamamlandı")

Expected output

İlk kayıt hazırlanıyor
İki commit tamamlandı

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which command is suitable when you want to prepare two files for the same commit?

  • git init index.html style.css
  • git branch index.html style.css
  • git add index.html style.css Correct answer
  • git commit index.html style.css

Explanation: Correct. You can use git add to stage multiple files at the same time.

2 Add Multiple Files

Question
git add index.html ____
Answer
git add index.html style.css

Explanation: You can list filenames separated by spaces in the git add command.

3 Parts of the Commit Workflow

Term Meaning
git status Displays changes
git add . Stages the current folder
-m Commit message option
git commit Records staged changes

All lessons in Beginner