CodeBlanks Logo Icon CodeBlanks

First file

Learn to create the first file and stage it.

Create the first file

You start by adding your first file to the repository, for example notlar.txt. Since the file has just been created Git does not know it yet; this state is called an untracked file. To enter the list of tracked files it must be staged.

echo ilk satir > notlar.txt

Right now this file only sits in the working folder.

Stage the file

To prepare the file for the next record you use the git add command. It moves the current state of the file to the stage, the place where content for the next record is prepared. The command runs silently and the file becomes tracked.

git add notlar.txt

Practice Create and stage a file

The repository is ready. Create the notlar.txt file and write ilk satir in it; stage the file with git add and list the folder contents.

Starter code

terminal
# 1) notlar.txt adinda bir dosya olustur
# 2) icine ilk satir yaz
# 3) dosyayi sahneye ekle
# 4) klasorun icerigini listele

Sample solution

terminal
echo "ilk satir" > notlar.txt
git add notlar.txt
ls

Expected output

notlar.txt

Questions and answers

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

1 What does untracked mean for a newly created file?

  • The file has been copied into the .git folder
  • The file has been stored encrypted
  • The file is saved and ready to be deleted
  • The file is not tracked by Git yet Correct answer

Explanation: Untracked means the file exists in the working folder but Git does not track it yet. After the git add command the file becomes tracked.

2 Stage the file

Question
echo "ilk satir" > notlar.txt
git add ____
Answer
echo "ilk satir" > notlar.txt
git add notlar.txt

Explanation: The file you need to stage is the notlar.txt file you just created.

3 File steps

Term Meaning
untracked A new file not tracked
git add Puts the file on the stage
echo > file Creates a new file
working directory Where you edit your files

All lessons in Beginner