- Feel free to leave anytime
- It is hands-on, try to do exercise, then we will do together
- All the step-by-step solution will be available, no need to take notes
- If you get lost, try to reset the repository and start again
- Otherwise, feel free to just follow along, you can do on your own later
module load gh
on Expansegh auth login
, protocol SSH, generate key with no password, authenticate via browser- Clone this repository to your home folder with
gh repo clone zonca/conversion_tofix
git config --global user.name "FirstName LastName"
git config --global user.email "[email protected]"
If you ever get lost and have an incosistent status of the repository as you work through the example, you can wipe all local changes both to main
and to fix_bug
and go back to the initial state of main
and restart from there:
git checkout main
git reset --hard origin/original_main
After you created the fix_bug
branch:
git checkout fix_bug
git reset --hard origin/original_main
- Test it running
python test_conversion.py
, does it fail? - Checkout the code version just before the last commit, does it still fail? How do you go back to the last commit?
- Identify the commit causing the bug with
git bisect
, see https://git-scm.com/docs/git-bisect bisect
is rarely useful in practice, let's skip it, it is in the solution if you are interested, now assume we know that the problematic commit is363a
- Create a new branch
fix_bug
- Undo it with
git revert
https://git-scm.com/docs/git-revert
- Try to push it back to the original repository with
git push origin fix_bug
, does it work?
- Look at
gh
docs at https://cli.github.com/ - Create fork, push the branch to fork and create a PR all from the command line
- Fork the repository under your Github account through the Github website
- Add your fork of the repository as a remote named
fork
to the repository on Expanse git push fork
yourfix_bug
to your repository- Go to https://github.com/zonca/conversion_tofix, create a Pull Request!
- I will create a new commit in my repository
- Create 2 branches, test
rebase
in one andmerge
in the other - After merge, inspect with
git log --graph --oneline
- I will create a new commit in my repository with a conflict
- Do a rebase and handle conflicts
- Use
git rebase
to completely wipe the commit from history - Try to push
- Wipe the last commit with
git reset --hard
- Setup a Github action to test the code on the
main
branch of your fork
- Publish
conversion.py
as a Gist usinggh