Quiz

  1. Could we talk more about git add and what it means to make a commit?

    Sure. A commit is one step in a software development project. It might be a big step or a small step, but it's a discrete, describable bit of progress.

    When we make such a step, it often means changes to several files. Suppose during a bunch of editing I change files A, B and C, but the change to C was just something I noticed and which is part of some other step, or maybe isn't ready yet. So, I add A and B to the commit, but not C.

    It's common to add every changed file to a commit, and some people routinely do

    git add .
    , but in principle you can be more selective.
  2. I am a little confused/scared by the idea that once content is added to a Git repository, it becomes permanent and unchangeable. Could you clarify more on it and explain how Git handles changes or removals?

    Great question. This is completely understandable. I, too, sometimes get nervous when I discover that I can't undo something that might be a mistake.

    But let's instead think of it as a detour. You went left (made some commits in that direction), discovered it was a bad idea or a dead end, so you went back, and took a right.

    Git will keep track of all that. But the mistake doesn't have to be part of the final product.

    However, a corollary of this is that you should nevery commit private, personal information (SSN numbers, passwords, API keys, etc), especially if you are pushing to a public repo on Github.

    In a pinch, you can always delete the entire local repo:

    rm -r
  3. Can we talk more about how to structure good commits?

    Sure. The basic principles are to commit often and to commit working code. There may be bugs, but they shouldn't affect your teammates too often.

  4. I have used Git in the past but not to this extent. I just need to really hands on to get used to using it.

    For sure!