Working areas in git
- Working directory
- Index (Staging area)
- Local repository
- Remote repository
1. Working directory
The area where we edit our files.2. Index (Staging area)
The area where are the files ready to commit to our local repository.3. Local Repository
The are where we put code we think we have finished editing.4. Remote repository
If we just put our code to remote repository we might consider it as backup, or if we interact with others we have an additional step.
Local vs Remote workspace
Also we need to separate what actions we perform on our computer (locally) or with others. Remote workspace can be defined as some other repository on the same computer, network storage, remote computer or dedicated service like github, bitbucket, gitlab, .... It isLocal workspace
We can define local workspace as everything we do using our computer without any interaction with remote code. In that area we can put following workspaces: working directory, index and local repository.The usual workflow in local workspace is following:
- Putting into local repository
We create code and add it into the staging area, we can check the changes we are about to put into the local repository. - Getting out of the local repository
We get the code from the repository into our working directory
Remote workspace
I would define remote workspace how we have interaction with others. So it is interaction between our local repository and remote repository.The usual workflow in remote workspace:
- Putting into remote repository
- single-user
Just put code into the the remote repository
- multi-user
Create a request to put code into the remote repository,
some other user needs to accept it after making a code review
- Getting code from the remote repository
There are two steps involved: fetching and merging the code.
First we fetch changes, see what has been changed, and merge to our local repository.
This is only introductionary post about git workspaces.