githubschool / palms

Let's learn about Git and GitHub
https://githubschool.github.io/palms/
MIT License
0 stars 0 forks source link

Parking Lot #7

Open githubteacher opened 3 years ago

githubteacher commented 3 years ago

Post any questions you may have here during the training.

ericalloyd commented 3 years ago

QUESTIONS FOR RESEARCH:

Yes, using git fetch --depth=<depth>.

Let's look at the log before we fetch. The most recent commit is 95fc034:

~/Documents/palms|main ⇒  git log --oneline

95fc034 (HEAD -> main, origin/main, origin/HEAD) Merge pull request #10 from githubschool/bethanyshen-isd-caption
796beb6 Merge pull request #20 from githubschool/mailoan-isd-cation
cae82bc Merge pull request #16 from githubschool/linan98-caption
.
.
.

There are 3 additional commits in origin/main branch that have not yet been pulled into the local main branch: c79fae3, 3afaa53, and fcd36b9,.

To fetch only the last 1, use the option --depth=1:

~/Documents/palms|main ⇒  git fetch --depth=1
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/githubschool/palms
 + 95fc034...fcd36b9 main       -> origin/main  (forced update)

Since we're only fetching and not merging, we won't see this commit in the log yet. We can verify that it has indeed been fetched by inspecting the commit:

~/Documents/palms|main ⇒  git show fcd36b9440988

commit fcd36b9440988f185ee9005da4c86e3fd5691248 (grafted, origin/main, origin/HEAD)
Author: Erica Lloyd <ericalloyd@github.com>
Date:   Mon Nov 9 16:57:18 2020 -0800

    Merge pull request #22 from githubschool/edit-2-ericalloyd-caption

    Update caption to describe awesomeness of dinos

I can verify that the other 2 commits were not fetched using the same command:

~/Documents/palms|main ⇒  git show c79fae3
fatal: ambiguous argument 'c79fae3': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

~/Documents/palms|main ⇒  git show 3afaa53
fatal: ambiguous argument '3afaa53': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

If we look at the log, it has not changed. The most recent commit is still 95fc034:

~/Documents/palms|main ⇒  git log --oneline
95fc034 (HEAD -> main) Merge pull request #10 from githubschool/bethanyshen-isd-caption
796beb6 Merge pull request #20 from githubschool/mailoan-isd-cation
cae82bc Merge pull request #16 from githubschool/linan98-caption
90429cc Merge pull request #14 from githubschool/tiffanylee94-caption
.
.
.

Git Docs: fetch with depth

ericalloyd commented 3 years ago

🎥 Recordings

Day 1 - November 9, 2020

Link: https://github.zoom.us/rec/share/p-bRSKMdV6D3FnEcXtzTV8czfxO2pOjvRMBKG71zTZslqSDaJHldmIF-8yT8ouHX.wpKt-3uxEaoTf7jO Passcode: Hs^!1$#=

Day 2 - November 10, 2020

Link: https://github.zoom.us/rec/share/QL53r_qUfgFW46IIZDI7m_PlH8e4zDj1iBckaDBeMvQT09YQEhz1Q6tNOZcyP6Fb.9BGnp_iUXkBIfUOR Passcode: VDfTu9+0