Git Workflow
How does Git work?
Before you actually commit a change, Git goes through a long chain of tasks and operations. A lot of these tasks are use controlled, which means you'll have to do them.
What are repositories?
Repositories can be hosted locally or on a shared server. They are also stored on GitHub, can be cloned to make them locally work on an external server for any contributors.
The difference between repositories and directories
Repositories are timelines of the entire project and include all previous changes.
Directories are projects at their current state in time, which is a snapshot of a part of the repositories.
The Workflow Diagram
You can start with a working directory that is running at a current state in time. Let's say that directory starts empty.
Now, you add a new file, maybe a script and some code do it, and you would like to add that project to your working directory. There are a few things you'll have to do before you can do that.
The Staging Area
This is an area that takes all the files, modifications and listed changes and bundles them up. Then, it puts it in to a commit.
Since the staging area is asynchronous, you can add and remove from the staging area.
When you only have the things you want to remain left, you can commit your changes, this will place them in the local repository.
The Local Repository and Remote Repository
To make sure your local repository is up to date, you should pull from your remote repository at the start of every session.
When you have made a commit, it will happen that your local and remote repositories are no longer the exact same. If you want to change that, you would have to push your changes from the local repository to the remote repository.
This cycle that I just described is done throughout the entire project.