WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Git · Basic · question 6 of 100

What are the basic Git workflow stages?

📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5

Git follows a three-stage workflow when working with files in a repository. These stages are:

    Working Directory
    Staging Area (Index)
    Repository (HEAD)

Here is a brief description of each stage:

Working Directory: This is the stage where you make changes to the files in your project. Any changes you make to files in this stage are not yet tracked by Git.

Staging Area (Index): This is the stage where you prepare your changes for a commit. You can use the git add command to add changes from the working directory to the staging area. Once you’ve added your changes to the staging area, they are ready to be committed to the repository.

Repository (HEAD): This is the stage where your changes are stored as commits in the Git repository. Once you’ve committed your changes, they become part of the repository’s history and can be viewed and tracked by other developers.

Here’s an example of how the Git workflow stages work in practice:

Working Directory: Suppose you have a file called index.html in your project directory, and you make changes to the file by adding some new content. These changes are made in the working directory and are not yet tracked by Git.

Staging Area (Index): To prepare your changes for a commit, you use the git add command to add the changes to the staging area:

    git add index.html

This command adds the changes you made to index.html to the staging area.

Repository (HEAD): Finally, you use the git commit command to commit your changes to the repository:

    git commit -m "Add new content to index.html"

This command creates a new commit with your changes and adds it to the repository’s history.

In summary, the Git workflow stages are a key part of the Git version control system. By understanding how changes move through the working directory, staging area, and repository, you can effectively manage your codebase and track changes over time.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Git interview — then scores it.
📞 Practice Git — free 15 min
📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5

All 100 Git questions · All topics