UMM-CSci-3601 / 3601-iteration-template

This template repository is used as a starting point for course projects in CSci 3601: Software Design and Development at the University of Minnesota Morris. It includes an Angular client along with a Javalin server and Mongo database.
MIT License
0 stars 9 forks source link

Test that student repos work in new GitHub Classroom using forks #1372

Open NicMcPhee opened 9 months ago

NicMcPhee commented 9 months ago

GitHub Classroom is switching to using forks instead of template copies in January 2024 when creating student copies of starter repos. (Thanks to @kklamberty for the heads up!)

I don't think this will affect us a lot, but we should make a point of testing that things work correctly in the new world.

It might affect some of the issues we've had with config info not migrating properly to student repos, but I don't know.

We'll be able to make fixes to the starter code and allow them to sync that up with their repositories, which will be nice.

The one thing that will definitely change in a way that will be visible to the students is that it will now carry all the old commits over to the student repo instead of starting them with a clean slate. This is a bummer because it was nice to know that all the commits on a repo came from the students. I'm sure we can use squashing to somehow squash all the previous commits into a single commit in some way that will allow them to start with just one commit, but I'm honestly not sure what that would look like.

NicMcPhee commented 9 months ago

ChatGPT suggested the following process for squashing everything down to one commit, which looked plausible but I haven't tried it. It will require that we create a new "starter" repository for every lab every semester, which will generate a certain amount of clutter, but we'll live. (We can delete those repos after the course is over if we want.)


To create a copy of a GitHub repository where all the commits are squashed into a single commit, you can follow these general steps. Please note that these steps assume you have Git installed on your local machine and have a basic understanding of Git commands.

  1. Clone the Original Repository: Clone the original repository to your local machine using the following command:

    git clone https://github.com/original/repository.git

    Replace https://github.com/original/repository.git with the actual URL of the original repository.

  2. Create a New Branch: Navigate to the cloned repository and create a new branch. This step is optional but recommended to keep your changes separate from the original repository.

    cd repository
    git checkout -b new-branch-name
  3. Squash Commits: Use an interactive rebase to squash commits. In this example, let's squash all commits into a single commit:

    git rebase -i HEAD~n

    Replace n with the number of commits you want to squash. In the interactive rebase window, change "pick" to "squash" (or just "s") for all but the first commit. Save and close the editor.

    If conflicts arise during the rebase, Git will prompt you to resolve them.

  4. Edit the Commit Message: After squashing, Git will prompt you to edit the commit message. Update the commit message as needed and save.

  5. Force Push to the New Branch: Once you've squashed the commits, force push the changes to the new branch:

    git push origin new-branch-name --force

    Be cautious when using --force as it overwrites the remote branch history.

  6. Create a New Repository on GitHub: Create a new repository on GitHub where you want to store the squashed changes.

  7. Push to the New Repository: Add the new repository as a remote and push the changes:

    git remote add new-origin https://github.com/your-username/new-repository.git
    git push new-origin new-branch-name

    Replace https://github.com/your-username/new-repository.git with the URL of your new repository.

Now, your new repository should contain a single commit with all the changes squashed. Keep in mind that force-pushing can be risky, especially if others are collaborating on the same branch, so use it with caution.

NicMcPhee commented 9 months ago

@kklamberty pointed out that this business of creating an intermediate starter repository does mean that if a problem arises after the lab starts, we'll have to remember to make changes both there and in the true "parent" repository in the UMM-CSci-3601 organization.