119 Git Basics
- create an account on GitHub
- get a Key
- install Git on your computer
- install Git on a folder
- add files
- commit
- push on GitHub
- remove files from staged area (index)
Unstaged changes are changes that are not tracked by the Git. For example, if you copy a file or modify the file. Git maintains a staging area(also known as index) to track changes that go in your next commit.
→ testingdocs.com: what-are-unstaged-and-staged-changes-in-git
The staging area is a file, in your Git directory, that stores information about what will go into your next commit. Staging the changes will put the files into the index. The next git commit will transfer all items from staging into your repository.
→ from stackexchange spoike (sweden)
Since everyone so far has answered it the "formal" way, let me do this with alternatives to enhance learning with the power of metaphors.
So the staging area is like:
- a cache of files that you want to commit
- not a series of tubes but actually a dump truck, ready to move the work you load it with, in to the repository
- a magical place where selected files will be turned into stone with your wizardry and can be magically transported to the repository at your whim
- the yellow brick road for the files to go happily to the repository (or fall off if you want to revert)
- the fictional place at the sea port where files are received a pair of cement shoes and then thrown into the repository sea
- the receptions desk at the library, you put the files there for the librarian to prepare for filing into the library
- a box where you put things in before shoving it under your bed, where your bed is a repository of boxes you've previously have shoved in
- the loading bay of files before it goes into the repository warehouse with the power loader
- the filter of an electric drip coffee maker, if the files are like the coffee powder, then the committed files are the brewed coffee
- the Scrooge McDuck's office next to the vault, the files are like the coins before they go into the vault of his massive Money Bin
- the pet store, once you bring a pet home you're committed
It's magical ! → stackexchange: what-does-stage-mean-in-git
Git does indeed have its own vocabulary. And since every instruction is formulated in the special vocabulary it is hard to get started.
To "stage" is to do git add file.ext for a specific file, or git add . to affect all modified and untracked files. Files that have been added in this way are said to be "staged" and they will be included in the next "commit".
The commit is a snapshot of your work created e.g. with git commit -m "I wrote something". –
→ Jonatan Öström - Dec 15, 2016
How to remove files from git staging area?
$ git reset HEAD -- ./pics
will unstage (remove) all files from ./pics
→ stackoverflow: how-to-remove-files-from-git-staging-area
URL of my Git Repository
$ git remote -v
How to switch Public/Private in GitHub
→ stackoverflow: how-can-i-switch-a-public-repo-to-private-and-vice-versa
How to create a branch
- Git commit - push on main branch
- create branch 2023 on GitHub
on the client:
$ git branch 2023 master
$ git checkout 2023
$ git branch => showing 2023 is active.