Member-only story
Learning Git — the basic commands
Previously: Learning Git — But Why?
In the last part, we learned what git is. Basically, a person who keeps track of what you have done in your project so far. But how do we do this? Well, we do this with the help of some basic commands. Before that let us get some simple concepts clear.
Workflow
The Git workflow is comprised of 3 main areas —
- Working Directory — This is where all the changes you make in your project will appear first. Say you make changes to a file. It first appears here. Git knows about the changes you have made but is still not tracking it.
- Staging Area — This is where Git starts tracking your changes. Once your changes are in this area they are ready to be written permanently into it’s history.
- Repository — This is where your changes are permanently written into Git’s history. We usually commit changes to this area.
Workflow as commands
Our project is in a folder calledtest
> mkdir test
— this is where all the changes will be done
> cd test
> touch abc.txt
— add a new file. This is a new change in your folder test
> git status
— this is a general command, you will be using it a lot, is to see if git is aware of some changes or not. You will be able to see a message in red that says you have a untracked file
name abc.txt
. This means…