How to stage changes in Git

Staging changes is a fundamental Git workflow step that allows you to selectively prepare files for commit and organize your modifications logically. As the creator of CoreUI, a widely used open-source UI library, I’ve staged thousands of changes across multiple repositories, carefully organizing commits for clear history and effective code reviews. From my expertise, the most essential approach is to use git add command with specific files or patterns. This method provides precise control over what changes are included in each commit, enabling atomic commits and better project organization.

Use git add command to stage specific files or changes for the next commit.

git add src/components/Button.js
git add . # stages all changes
git add *.css # stages all CSS files

The git add command moves changes from your working directory to the staging area (index), preparing them for the next commit. You can stage specific files with git add filename, all changes with git add ., or use patterns like git add *.js for file types. The staging area allows you to review and organize changes before committing, enabling you to create logical, atomic commits that are easier to review and revert if needed. Use git status to see staged vs unstaged changes.

Best Practice Note:

This is the same approach we use in CoreUI development for organizing commits and maintaining clean project history. Use git add -p for interactive staging to select specific hunks of changes within files, and git add -A to stage all changes including deletions for comprehensive commits.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.

Answers by CoreUI Core Team