The basic workflow - UnbDroid/AprendendoGithub GitHub Wiki

About the control version

The git is powerful and has a good control version. An example of version control is renaming the files, that is, we have on the same folder many versions of the same, like:

myfile.txt
myfile_18_02_03.txt
myfile_18_01_27.txt
myfile_18_01_16.txt

Where the myfile.txt is the newest. But it is ugly and difficult, that is, a bad version of control. Using the same idea, we have the commits: every commit is a version.

The basic workflow

There a representation that we call Basic Git Workflow and inside it we have 4 stages that we call:

  • Working Directory
  • Staging Area
  • Repository
  • Remote Repository

Only the last is Remote and the rest are Local. That means that only the fourth depend upon the internet and who acess the github.com will see only the last one.

The image below shows how the 4 stages.

Once you have the repository with the .git inside it, your repository is tracked by the git.

That means there are the 3 stages inside the repository: Working Directory, Staging Area, Repository

To understand about these 3 stages, we have an example. Let's suppose that we have 3 boxes:

  • Box A means Working Directory
  • Box B means Staging Area
  • Box C means the commits already done

Imagine that you have the last version of myfile.txt in your last commit and you changed something inside it.

If you have just created a repository or cloned someone, your workspace is clean. If your workspace is clean, everything you see inside your folders is inside the Box C.

Credits

The frist image