- Student starts coding assignment in class with cloned repo from github.
- Student goes homes and clones it again to continue work, does commits and push
- Student comes back to school, and wants to resume work…
Here is the question.
Should the students REBASE to bring their code up to speed? What is the best practice?
Before leaving the school, the students have to push to the remote repository, otherwise when at home they will “not continue” to work on the same basis; instead, they will clone locally an out-of-date code.
The same applies when they get back to school.
Assuming you are not using branching, rebasing is advisable since it will not create unnecessary merge commits.
A simple push and pull should suffice in the given example.
I’m not a fan of rebasing in the given context. You’d be using rebase for things it was not intended for…
The main rebase purpose at Git: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
@ConsoleFriend rebasing works also with single branch workflow to keep the history clean without producing unnecessary bifurcation.
Example: one student forgets to pull at home as first operation and commits locally a change. Here rebasing avoids creating a merge commit. This will go smooth as long as there won’t be conflicts to solve. However, conflicts arise both with and without rebasing.
In git community, rebasing has become more a mindset than a mere operation
@pattacini indeed I agree that this works perfectly with a single branch workflow. However during classes this is something I’d strongly advise against when teaching the usage of git to my students.
@ConsoleFriend Yes, I see. Branching and thus rebasing can be tough for a novice to catch completely in their essence and one might end up doing a messy job. Nevertheless, branching and thus rebasing do represent let’s say 50% of Git core, a thing that makes Git quite unique with respect to other tools.
@pattacini , indeed. My comments here are purely based on the basic knowledge and initial steps that students take in working with Git via Github. Wrapping their minds over what to use when in the early stages often takes up more time than the actual programming.