Hands-on Git Tasks - Part #2 of 5 | Checking Git Objects

This post is part of a 5-post series on using Git.

Hands-on Git Tasks - Part #1 of 5 | First Git Commit

Hands-on Git Taks - Part #2 of 5 | Checking Git Objects

Hands-on Git Tasks - Part #3 of 5 | Navigating Project Branches

Hands-on Git Tasks - Part #4 of 5 | Using Remote Repository

Hands-On Git Tasks - Part #5 of 5 | Merging

Follow these steps for an example of how to check your Git objects in your AWS Cloud9 environment. (For steps to create your Cloud9 Environment, go here: https://medium.com/@lewislampkin/creating-an-integrated-developer-environment-ide-in-the-cloud-in-two-minutes-c96e33b2fa3e)

01. Listing objects
ls .git/objects

02. Listing objects hash
ls .git/objects/a4
ls .git/objects/c1
ls .git/objects/d7

03. Object Type
git cat-file -t "40-character-hash"

Note: the first two characters were from the object name, and the last 38 chracters were from the object hash

04. Object Content
git cat-file -p "40-character-hash"

05. See file contents (similar to cat, using a git command)
git show

06. Creating another file: providers.txt
echo "AWS, AZURE, GCP and OCI" > providers.txt
ls -a
cat providers.txt

07. Checking git status
git status

08. A slightly different version of git add (everything)
git add .
git status

09. Lets' run a commit
git config --list
git commit -m 'My Second DevOps Cloud Bootcamp Commit'
git status

10. Let's check the commit history
git log
git log --oneline

11. Check git objects [compare to #01 image]

1c 2f 4d a4 c1 d7 info pack
a4 ca d7 info pack

Notice that 1c, 2f, and 4d were not there before, as these are associated with this second commit (starting with 2f, versus first commit that started with c1)

12. Check the timestamps, via "ls -al"

13. Check the type and content of the commit hashes. (from git log}

If you want to find me, you can catch me, Lewis Lampkin, III at LinkedIn: https://www.linkedin.com/in/lewislampkin

If you want to read my blog: https://www.lewislampkin.com


Popular posts from this blog

Containing the Chaos! | A Three-Part Series Demonstrating the Usefulness of Containerization to HumanGov

Ansible is the Answer! | A Three-Part Series Demonstrating the Usefulness of Ansible to HumanGov