Open source softwares - GIT

Back to Course

Lesson Description

Lession - #1115 Git Staging Environment

What is a git staging environment?
The staging area is like a rough draft space, it's wherever you'll git add the version of a file or multiple files that you simply wish to save in your next commit (in alternative words within the next version of your project>

Why is git staging area needed?
staging helps you keep extra local files hanging around

Usually, files that should not be committed move into . gitignore or the local variant, . git/info/exclude . However, generally you want a local change to a file willnot|that can't} be excluded (which is not sensible practice but can happen sometimes>

As you're working, you'll be adding, editing and removing files. but whenever you hit a milestone or finish a part of the work, you should add the files to a Staging environment.

Staged files are files that are ready to be committed to the repository you're working on. you may learn a lot of about commit shortly.

For now, we are done working with index.html. thus we will add it to the Staging Environment:


git add index.html

The file should be Staged.

Let's check the status::

git status

On branch master

No commits yet

Changes to be committed:
(use "git rm --cached ..." to unstage>
new file: index.html

Now the file has been added to the Staging environment.

Git Add quite One File

You can also stage more than one file at a time. Let's add two more files to our working folder. Use the text editor again.

A README.md file that describes the repository (recommended for all repositories>