In order to collaborate efficiently using Git, it’s essential to have a solid understanding of how remotes work, and how to contribute changes through pull requests. The git-intro lesson teaches participants how to work efficiently with Git when there is only one developer. This lesson dives into the collaborative aspects of Git and focuses on the possible collaborative workflows enabled by web-based repository hosting platforms like GitHub.
This lesson is meant to directly benefit workshop participants who have prior experience with Git, enabling them to put collaborative workflows involving code review directly into practice when they return to their normal work. For novice Git users (who may have learned a lot in the git-intro lesson) this lesson is somewhat challenging, but the lesson aims to introduce them to the concepts and give them confidence to start using these workflows later when they have gained some further experience in working with Git.
By the end of this lesson, learners should:
You can adjust the location of the exercises in case you plan to generate/import them to a custom place.
This is the default:
centralized_workflow_exercise_url: https://github.com/coderefinery/centralized-workflow-exercise
forking_workflow_exercise_url: https://github.com/coderefinery/forking-workflow-exercise
But you can change these in _config.yml
and this will change the locations in this instructor guide
but also in the lesson episodes.
First verify that these repos exist - never remove these, never use these directly during a course:
Then delete the copied exercise repositories from a previous workshop. Make sure to not remove the templates above - you only want to remove their copies:
Now create the two above exercises by generating these two templates:
Finally give all instructors admin rights to the two newly created exercise repositories and write-protect the
master
branch until we really start pushing to the repository.
The motivation for the above steps:
Add at least one other helper as an admin to the newly copied centralized-workflow-exercise (let the other helpers know who that is), so that someone can give latecomers write access without asking the main presenter.
After inviting participants as collaborators, give them the invite link, otherwise the invitations can be swallowed by spam filters.
Check https://github.com/coderefinery/centralized-workflow-exercise (adjust the URL if you have imported the exercise into another custom location):
If participants run git graph
they might notice origin/HEAD
.
This has been omitted from the figures to not overload them.
This pointer represents the default branch of the remote repository.
The difference between pull and pull requests can be confusing, explain clearly that pull requests are a different mechanism specific to GitHub, GitLab, etc.
The behavior that additional commits to a branch from which a pull request has been created get appended to the pull request needs to be explained.
git graph
a lot, just like in the git-solo lesson.