Git & GitHub Interview Question #8

What is the basic Git workflow?

Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner

Quick Interview Answer

A common Git workflow is: modify files in the working directory, inspect changes, stage the intended changes, commit them locally, and then push commits to a remote repository when collaboration or backup is required.

Detailed Explanation

A common Git workflow is: modify files in the working directory, inspect changes, stage the intended changes, commit them locally, and then push commits to a remote repository when collaboration or backup is required.

The three core local states to remember are working tree, staging area, and committed history.

Code Example

git status
git add .
git commit -m "Fix responsive question page"
git push origin main