git-novice
git-novice copied to clipboard
Add a git fetch exercise?
Every time I teach this, participants ask how they can check to see whether origin has been updated before they try to git push so as to know in advance whether they're going to have to merge anything, or more generally just to compare their latest committed version with origin.
Is it worth adding a small exercise showing git fetch, and then how to compare master with origin/master?
I agree. I also think it would be worth clarifying that git pull is equivalent to git fetch && git merge origin/<upstream-branch>. That would demystify git pull a bit, as well as clarifying the separation between merging branches and interacting with an upstream repo.
8 - Collaborating mentions fetch, but only in the solution to the review changes challenge at the end.
As @naught101 mentions, pull should be clearly defined as a combination of fetch and merge.
I think git fetch is starting to go into intermediate territory, which is out of scope for a novice lesson. Maybe if this were a full-day lesson, but since it isn't we need to be careful that this novice lesson doesn't go out of scope.