The staging area can hold changes from any number of files that you want to commit as a single snapshot.
guacamole.md noting the rough price of the ingredients.groceries.md with a list of products and their prices for different markets.
First we make our changes to the guacamole.md and groceries.md files:
$ nano guacamole.md
$ cat guacamole.md
# Ingredients
- avocado (1.35)
- lime (0.64)
- salt (2)
$ nano groceries.md
$ cat groceries.md
# Market A
- avocado: 1.35 per unit.
- lime: 0.64 per unit
- salt: 2 per kg
Now you can add both files to the staging area. We can do that in one line:
$ git add guacamole.md groceries.md
Or with multiple commands:
$ git add guacamole.md
$ git add groceries.md
Now the files are ready to commit. You can check that using git status. If you are ready to commit use:
$ git commit -m "Write prices for ingredients and their source"
[master cc127c2]
Write prices for ingredients and their source
2 files changed, 7 insertions(+)
create mode 100644 groceries.md