In: Computer Science
1. Using git commands and terminology, briefly explain how changes to files go from a working directory to a remote repository and from remote repository to the working directory. Answers that properly use git commands to explain how changes to files go from the working directory to the remote repository and vice versa.
2. In your own words, briefly explain the different git "places"
1)
The working directory is where we have our source files under git control and the remote repository refers to the repository which the team members use in order to bring some new updates and changes on the project on GitHub. So while we make changes in the real project i.e. our working repository, we have to update the remote repository as well and vice versa.
To see what was changes in the remote repository use $git status.
To commit the changes i.e. edit or add new files in the working repository use $git add and then $git commit.
To see what changes were made use $git log.
To add the canges from the working directory to the remote repository use $git push.
There is a layer in between the working directory and the remote repository it is called the staging area. It is in this area where the changes are first stored or added when the user uses the $git add command. At this place the project and all the stuff is thoroughly checked as well.
It is after this stage thet one uses the $git commit command to push the changes to the remote repository on github.
2)
There are majorly three areas where we work on git. They are as under:
> Working Tree
> Staging Area
> Local Repository
The working tree is the area in git where one is currently working, it is that area where if the user make some changes and do not save them before closing he/she will loose all the changes that they have made tiil now. It is also called the untracked area of git.
The Staging area is one where github starts tracking the changes that have been made into the files. At this stage is when git starts saving those changes that have occured in the files. These saved changes will be reflected in the .git directory of the project.
The local repository includes everyhting that the user have in their .git directory. It is this area that saves everything that one has for their peoject uploaded on github, So, deleting it will make the user loose everything that they have, and if the project is no longer available in their working system they might loose it forever.