Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial 2 2022-2023 w2 #30

Open
chendaniely opened this issue Jan 20, 2023 · 0 comments
Open

Tutorial 2 2022-2023 w2 #30

chendaniely opened this issue Jan 20, 2023 · 0 comments

Comments

@chendaniely
Copy link
Contributor

chendaniely commented Jan 20, 2023

Tutorial 2 - Git + GitHub Practice

Using the version control chapter from our course notes:
https://ubc-dsci.github.io/reproducible-and-trustworthy-workflows-for-data-science/materials/lectures/02-version-control-1.html

Important note:

  • You will be creating + cloning multiple git repositories in this tutorial
  • Make sure you DO NOT nest your git repositories (i.e., clone 1 repository inside another)
  • If you do this by accident, you can move the folders so they are siblings to each other

Exercise 1: Simple File Merge Conflict

Steps:

  1. Click the green “Use this template” > "Create a new repository" button from this GitHub repository to obtain a copy of it for yourself (do not fork it).

    • Name it YYYY-MM-DD-merge_conflict_1
    • Leave everything else empty/default
    • Click "Create repository from template"
  2. Clone this repository to your computer (make sure you do this step in order)

    • Code > HTTPS or SSH URL > copy to clipboard
    • git clone <URL> (e.g., in your ~/git folder)
  3. Allow the GitHub action to create the merge conflict

    • Go to repository settings (not your account settings on the top right corner)
    • Go to Actions tab on the left side
    • Click General
    • Scroll all the way to the bottom to the "Workflow permissions" section
    • Check off "Read and write permissions" and "Allow Github Actions to create and approve pull requests"
    • Click "Save
  4. Create a remote branch named make-conflict (this will use GitHub Actions to create a commit in your remote repository).

    • Click on the main drop down
    • type make-conflict as the branch name
    • Click "create branch: make-conflict from main"
    • Click on the "Actions" tab and watch the Github action go from yellow -> green
    • If it goes red and fails, you probably missed the previous step
    • You can click on the workflow and then > re-run all jobs to re-run on failure
  5. On your local computer (where you cloned, fix the second line in cube.r so that it calculates the cube, not the square (e.g., change x^2 to x^3).

    • do this on the main branch on your local machine
  6. commit your changes to version control via Git and push your changes to GitHub.

    • you may need to set the git config pull.rebase false setting for default merge behaviour
    • you should be making your changes on the main branch, and be pushing to main on the remote
  7. Resolve the merge conflict so that you can see your changes on GitHub.

    • when you push it will be blocked because of the changes from the bot
    • the merge conflict will trigger when you pull the remote contents
    • tip: use git status to help you through committing the conflict after you fix the file

Exercise 2: Complex File Merge Conflict

Exercise 3: Do a code review with a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant