You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"
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)
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
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
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
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
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
Same process as above where you will create repo as template, clone, allow gh action permissions, make-conflict branch, edit file locally, and push / fix conflicts
The VSCode python extension should be able to open/read .ipynb files, you don't really need to try and execute the code blocks for this to work.
During merge conflict resolution, because it's not a valid JSON file/notebook anymore, you will have to fix things in regular plain text mode
If you click on cube.ipynb after conflict + push, it should render in github
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:
Exercise 1: Simple File Merge Conflict
Steps:
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).
YYYY-MM-DD-merge_conflict_1
Clone this repository to your computer (make sure you do this step in order)
git clone <URL>
(e.g., in your~/git
folder)Allow the GitHub action to create the merge conflict
Create a remote branch named
make-conflict
(this will use GitHub Actions to create a commit in your remote repository).main
drop downmake-conflict
as the branch nameOn your local computer (where you
clone
d, fix the second line incube.r
so that it calculates the cube, not the square (e.g., change x^2 to x^3).main
branch on your local machinecommit
your changes to version control via Git andpush
your changes to GitHub.git config pull.rebase false
setting for default merge behaviourmain
branch, and be pushing tomain
on the remoteResolve the merge conflict so that you can see your changes on GitHub.
pull
the remote contentsgit status
to help you through committing the conflict after you fix the fileExercise 2: Complex File Merge Conflict
https://ubc-dsci.github.io/reproducible-and-trustworthy-workflows-for-data-science/materials/lectures/02-version-control-1.html#resolving-merge-conflicts-in-a-more-complex-text-file
Use
YYYY-MM-DD-merge_conflict_2
as the repo nameSame process as above where you will create repo as template, clone, allow gh action permissions,
make-conflict
branch, edit file locally, and push / fix conflictsThe VSCode python extension should be able to open/read
.ipynb
files, you don't really need to try and execute the code blocks for this to work.During merge conflict resolution, because it's not a valid JSON file/notebook anymore, you will have to fix things in regular plain text mode
If you click on
cube.ipynb
after conflict + push, it should render in githubExercise 3: Do a code review with a pull request
https://ubc-dsci.github.io/reproducible-and-trustworthy-workflows-for-data-science/materials/lectures/02-version-control-1.html#demo-do-a-code-review
special note about this exercise:
master
notmain
use
YYYY-MM-DD-pr_1
as the repo nameyou don't need to clone the repo to your computer, you can fix and modify the code directly in github
make sure you change the action > general > Workflow permissions as exercise 1
create a new branch in the interface called
pr
it will create an action and generate a PR for reviewGo to the Pull Request tab
Click on the PR created
Follow steps in exercise, try to make a comment
Usually the person who submitted the PR is responsible for fixing their code
Merge the pull request when done (it's just an exercise to go through all the mechanics)
The text was updated successfully, but these errors were encountered: