Skip to content

Instantly share code, notes, and snippets.

@hamouj
Last active October 12, 2022 04:12
Show Gist options
  • Save hamouj/8606fed7a7a536cb5cbdee6af67194ad to your computer and use it in GitHub Desktop.
Save hamouj/8606fed7a7a536cb5cbdee6af67194ad to your computer and use it in GitHub Desktop.

Git - Check For Understanding

Git Workflow

Follow the steps below to practice the Git workflow. Be ready to copy-and-paste your Terminal output as confirmation of your work.

  1. Create a directory called git_cfu. Inside of that directory, create a file called thoughts.md.
  2. Initialize the directory.
  3. Use git status to ensure you are set up for tracking using Git.
  4. Add your thoughts.md to the staging area.
  5. Check the git status.
  6. Create an initial commit. (Note: Be sure to follow the correct message format for your first commit!)
  7. Check the git status.
  8. Add two takeaways you've had from your first hours of Mod 0 as it relates to success at Turing.
  9. Check the git status.
  10. Check the changes you've made using git diff.
  11. Add the changes to the staging area.
  12. Commit the new changes. (Note: Be sure to follow convention for commit messages!)
  13. Check the status.
  14. Add two new strategies you are committed to trying during the rest of Mod 0 to thoughts.md.
  15. Add the changes to the staging area.
  16. Commit the new changes. (Note: Be sure to follow convention for commit messages!)
  17. Add at least one shoutout to someone who has helped you, supported you, or just been a positive presence in the last two weeks!
  18. Add the changes to the staging area.
  19. Commit the new changes. (Note: Be sure to follow convention for commit messages!)
  20. Show the log of your work in oneline format using git log --oneline.

Copy and paste all of the Terminal text from this process below (not just the history):

jasminehamou@Jasmines-MBP ~ % pwd
/Users/jasminehamou
jasminehamou@Jasmines-MBP ~ % cd desktop
jasminehamou@Jasmines-MBP desktop % cd 0Mod      
jasminehamou@Jasmines-MBP 0Mod % mkdir git_cfu
jasminehamou@Jasmines-MBP 0Mod % cd git_cfu 
jasminehamou@Jasmines-MBP git_cfu % touch thoughts.md
jasminehamou@Jasmines-MBP git_cfu % git init
Initialized empty Git repository in /Users/jasminehamou/Desktop/0Mod/git_cfu/.git/
jasminehamou@Jasmines-MBP git_cfu % git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	thoughts.md

nothing added to commit but untracked files present (use "git add" to track)
jasminehamou@Jasmines-MBP git_cfu % git add thoughts.md 
jasminehamou@Jasmines-MBP git_cfu % git commit -m "Initial commit"
[main (root-commit) 18dd5b2] Initial commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 thoughts.md
jasminehamou@Jasmines-MBP git_cfu % git status
On branch main
nothing to commit, working tree clean
jasminehamou@Jasmines-MBP git_cfu % git diff
jasminehamou@Jasmines-MBP git_cfu % code .
jasminehamou@Jasmines-MBP git_cfu % git status
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   thoughts.md

no changes added to commit (use "git add" and/or "git commit -a")
jasminehamou@Jasmines-MBP git_cfu % git diff
diff --git a/thoughts.md b/thoughts.md
index e69de29..c9d8ffc 100644
--- a/thoughts.md
+++ b/thoughts.md
@@ -0,0 +1,3 @@
+# My Two Takeaways
+1. It's all new and scary, but if you take the time, it'll make sense.
+2. Have caffeinated beverages/food handy!
\ No newline at end of file
jasminehamou@Jasmines-MBP git_cfu % add thoughts.md 
zsh: command not found: add
jasminehamou@Jasmines-MBP git_cfu % git add thoughts.md 
jasminehamou@Jasmines-MBP git_cfu % git commit -m "Add two takeaways"
[main 1cd762e] Add two takeaways
 1 file changed, 3 insertions(+)
jasminehamou@Jasmines-MBP git_cfu % git status
On branch main
nothing to commit, working tree clean
jasminehamou@Jasmines-MBP git_cfu % git add thoughts.md 
jasminehamou@Jasmines-MBP git_cfu % git commit -m "Add two strategies"
[main c6f0d34] Add two strategies
 1 file changed, 4 insertions(+), 1 deletion(-)
jasminehamou@Jasmines-MBP git_cfu % git status
On branch main
nothing to commit, working tree clean
jasminehamou@Jasmines-MBP git_cfu % git add thoughts.md 
jasminehamou@Jasmines-MBP git_cfu % git commit -m "Add shout out"
[main 12cc6ba] Add shout out
 1 file changed, 3 insertions(+), 1 deletion(-)
jasminehamou@Jasmines-MBP git_cfu % git log --oneline
12cc6ba (HEAD -> main) Add shout out
c6f0d34 Add two strategies
1cd762e Add two takeaways
18dd5b2 Initial commit
jasminehamou@Jasmines-MBP git_cfu % 

Self-Reflection

Please respond to the following questions in writing directly in this Gist.

  • How confident do you feel in your understanding and fluency with the Git workflow? I understand and can use the commands and the workflow covered, but would still like some feedback on my commit comments to make sure they meet the criteria.
  • What do you still need to practice or learn? How will you do that? I still need some practice with commit commands, ensuring that they are concise but also include needed information. I hope that by learning more about Git, I'll get further exposure and examples. If needed, I'll practice during the time set aside on my calendar and reach out to my small group for feedback on my comments.
  • What part of the Git Workflow is still confusing for you? I'm still a little confused on the git init command. I know that you use it at the creation of a directory, but am not fully sure the purpose of it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment