Series Two: Git Essential Training: The Basics

  • Writing commit messages
  • How to view commit logs that has been made to a project
  • Git three trees architecture
  • Git Workflow
  • Hash values (SHA-1)
  • The HEAD Pointer in Git
  • Add changes
  • Commit changes to the repository with a message
  • Keep each line to less than 72 characters, the reason why is that users maybe viewing it on their computer or mobile device through Github
  • Write your commit messages in present tense, and not past tense
  • “Fix for a bug” or “fixes a bug”, not “fixed a bug”
  • The commit message is a label for changes,
  • You can develop shorthand for your organization, for example you can begin each commit message with the following for whether you are committing a javascript or css, or is it bug fix
  • “[css, or js]”
  • “[bugfix]”
  • Make sure your commit message is clear and descriptive
  • Bad: “fix typo”
  • Good: “add mixing hyphen in project section of HTML”
  • Bad: “Update login code”
  • Good: “Change user authentication to use Blowfish”
  • The first number is the unique ID, every commit is given an ID so we can identify a particular commit that we might be interested in.
  • Next is the author who made the commit, it shows the name and email
  • Date commit was made
  • Commit message
  • git help log will show more about the commit command
  • git log -n 3; will limit the number of commits given to the command which is 3
  • git log — since=2019–01–0, this command will show all commits since 2019. You can limit commits until
  • git log –grep=”init”: grep means we are going to globally search for regular expressions, it helps to search for commit messages. It will return any commits that have the string “init” in it.
  • We have the repository and working directory, we call them trees because they represent a file structure, at the top you have the project directory, and below, you can have more folders with files inside. We use checkout to create a new working directory, and after making changes to our working directory, we commit the changes back to the repository
  • Working directory which contains changes that may not be tracked by git yet
  • Staging index, which contains changes we are about to commit
  • Repository, this is what is being tracked by git.
  • git add <filename> : adds the specified file or this single file to the staging index
  • git commit -m “” is then used to push file to the repository
  • A checksum is a number that is generated by taking data and feeding it into a mathematical algorithm, so the checksum converts data into a simple number, and we call that simple number checksum.
  • Same data put into the same mathematical algorithm, always returns the same result or checksum. This ensures data integrity, and this inbuilt in git
  • Data integrity is fundamental
  • Each hash value is unique and directly tied to the changes inside it.
  • The algorithm that git uses to create checksums is the SHA-1 hash algorithm.
  • The number generated from the SHA-1 algorithm is a 40 character hexadecimal string (meaning it contains the numbers 0–9, and the letters a-f)
  • git monitors not only our changes but also their history
  • The HEAD references a point to a specific commit in the repository, as we make new commits, the pointer changes, or moves to point to a new commit.
  • The HEAD always points to the parent of the next commit
  • A new branch is a new set of code from what we are working on, and it will be separate from our master branch.
  • Inside the .git directory, there is a file called HEAD. Inside it, you will find (ls -la .git)
  • How git handles files that have been edited
  • How to view changes in a committed file
  • View only staged changes
  • How to use git to track files that are deleted
  • How to track moved or renamed file using git
  • Introducing the explore California project
  • How to view a previous commit
  • Comparing commits
  • Multiline commit messages
  • Making Atomic commits
  • Amending commits already in the repository
  • Retrieving old versions of files
  • Reverting a commit
  • Removing Untracked files
  • Use .gitignore files
  • Globally ignore files

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ruby on Rails Generators (and how to undo them)

How Do I Speed Up A WordPress Website?

Top .NET development companies to outsource

Getting Started with Terraform and Infrastructure as Code

LeetCode 15. 3Sum — Python Solution

Assign specific authorization scheme to endpoint in Swagger UI in .NET core

Product Development — Going Beyond the ‘Customer’

ApprenticeCTO’s Curated News — Digest #1/2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gino Osahon

Gino Osahon

More from Medium

Series One: Git Essential Training: The Basics

A Wholesome Guide to Version Control using Git & Github for Beginners

Powerful extensions for developers

Git Repository Clean Up