Minor fixes to the blog post after third party reviewer's opinion.

This commit is contained in:
Elia el Lazkani 2019-07-23 01:01:54 +02:00 committed by Elia El Lazkani
parent b8e566557e
commit 7ff708a842
No known key found for this signature in database
GPG key ID: FBD81F2B1F488C2B

View file

@ -1,7 +1,7 @@
.. title: Git! First Steps... .. title: Git! First Steps...
.. date: 2019-07-22 .. date: 2019-07-22
.. slug: git-first-steps .. slug: git-first-steps
.. updated: 2019-07-22 .. updated: 2019-07-23
.. status: published .. status: published
.. tags: git, revision-control .. tags: git, revision-control
.. category: revision-control .. category: revision-control
@ -24,17 +24,17 @@ I'd like to start my post with a requirement, ``git``. It has to be installed on
A Few Concepts A Few Concepts
============== ==============
I'm going to try to explain a few concepts in as simple a way, even though not always totally accurate, possible as I can. I'm going to try to explain a few concepts in a very simple way. That means I am sacrificing accuracy for ease of understanding.
What is revision control? What is revision control?
------------------------- -------------------------
`Wikipedia <https://en.wikipedia.org/wiki/Version_control>`_ describes is as: `Wikipedia <https://en.wikipedia.org/wiki/Version_control>`_ describes it as:
A component of software configuration management, version control, "A component of software configuration management, version control,
also known as revision control or source control, is the management also known as revision control or source control, is the management
of changes to documents, computer programs, large web sites, and of changes to documents, computer programs, large web sites, and
other collections of information. other collections of information."
In simple terms, it keeps track of what you did and when as long as you log that on every change that deserve to be saved. In simple terms, it keeps track of what you did and when as long as you log that on every change that deserve to be saved.
This is a very good way to keep backups of previous changes, also a way to have a history documenting who changed what and for what reason (NO! Not to blame, to understand why and how to fix it). This is a very good way to keep backups of previous changes, also a way to have a history documenting who changed what and for what reason (NO! Not to blame, to understand why and how to fix it).
@ -42,14 +42,14 @@ This is a very good way to keep backups of previous changes, also a way to have
What is a git commit? What is a git commit?
--------------------- ---------------------
You can read all about what a commit is on the `manual page <https://git-scm.com/docs/git-commit>`_ of ``git-commit``. You can read all about what a commit is on the manual page of `git-commit <https://git-scm.com/docs/git-commit>`_.
But the simple way to understand this is, it takes a snapshot of your work and names it a ``SHA`` number (very long string of letters and numbers). A ``SHA`` is a unique name that is derived from information from the current commit and every commit that came before since the beginning of the tree. But the simple way to understand this is, it takes a snapshot of your work and names it a ``SHA`` number (very long string of letters and numbers). A ``SHA`` is a unique name that is derived from information from the current commit and every commit that came before since the beginning of the tree.
In other words, there is an extremely low chance that 2 commits would ever have the same ``SHA``. Let's not also forget the security implication from this. If you have a clone of a repository and someone changed a commit somewhere in the tree history, every commit including the one changed and newer will have to change names. At that point, your fork will have a mismatch and you can know that the history was changed. In other words, there is an extremely low chance that 2 commits would ever have the same ``SHA``. Let's not also forget the security implication from this. If you have a clone of a repository and someone changed a commit somewhere in the tree history, every commit including the one changed and newer will have to change names. At that point, your fork will have a mismatch and you can know that the history was changed.
What is the ``git add`` thingy for? What is the ``git add`` thingy for?
----------------------------------- -----------------------------------
Well the ``git-add`` `man page <https://git-scm.com/docs/git-add>`_ is very descriptive about the subject but, once again, I'll try to explain it in metaphors. Well the `git-add <https://git-scm.com/docs/git-add>`_ manual page is very descriptive about the subject but, once again, I'll try to explain it in metaphors.
Think of it this way, ``git-commit`` saves the changes, but what changes ? That's exactly the question to answer. What changes ? Think of it this way, ``git-commit`` saves the changes, but what changes ? That's exactly the question to answer. What changes ?
What if I want to commit some changes but not others ? What if I want to commit all the code in one commit and all the comments in another ? What if I want to commit some changes but not others ? What if I want to commit all the code in one commit and all the comments in another ?
@ -58,7 +58,7 @@ That's where the "staging area" comes in play. You use ``git-add`` to stage file
Practice Practice
======== ========
Now that we've already explained a few concepts, let's see how this all fits together, shall we ? Now that we've already explained a few concepts, let's see how this all fits together.
Step 1: Basic git configuration Step 1: Basic git configuration
------------------------------- -------------------------------