subtitle | output |
---|---|
Go to next slide |
ioslides_presentation |
knitr::opts_chunk$set(echo = FALSE)
Mauro Lepore
--
Repo: http://bit.ly/github-demo
Slides: http://bit.ly/github-berlin
--
- Use https://rstudio.cloud, or
- just watch and ask at the end.
Creative Commons Attribution-ShareAlike 4.0 International
http://creativecommons.org/licenses/by-sa/4.0
--
Many images and ideas come from
https://jennybc.github.io/wtf-2019-rsc/
Excuse me, do you have a moment to talk about version control?
-
GitHub flow from GitHub:
-
Recap: Understanding the GitHub flow.
-
Questions
-
GitHub flow via RStudio:
- Happy Git with R: Fork and clone.
- Happy Git with R: Get upstream changes for a fork.
-
Questions / Discussion, e.g.:
- Git clients.
- usethis package: Pull request helpers.
https://happygitwithr.com/workshops.html#pre-workshop-set-up
In R
usethis::edit_git_config()
In the terminal
git config --global -l
git config --global user.email "[email protected]"
git config --global user.name "maurolepore"
core.editor=notepad
push.default=current
pull.ff=only
git checkout -b 57_add-full-url
git push -u origin 57_add-full-url
# Or
git config --global push.default "current"
git push
git add .
git commit -m "Add full URLs (closes #57)"
git commit --amend -m "Agregar URLs completos (closes #57)"
git reset --hard
git checkout master
# Agregar el remoto "upstream"
git remote add upstream [email protected]:maurolepore/fgeo.plot.git
git fetch upstream
git checkout master
git rebase upstream/master
# reset ~1 commit
# reset ~2 commits
# reset ~n commits
git reset HEAD~1
# ~1 revert ~1 commit
# --no-edit for auto message
git revert HEAD~1 --no-edit
# Revert commit with SHA a867f483
git revert a867f483 --no-edit
# Cherry pick commit 63da5bb3
git cherry-pick 63da5bb3
# Local
git branch -d a-branch
# Local, force
git branch -D a-branch
# From remote origin
git push -d origin a-branch
# From remote upstream
git push -d upstream a-branch
# ~3 manipulate ~3 commits
git rebase -i HEAD~3
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# ...
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
git rebase --abort
git commit --amend -m "New commit message"
git rebase --continue
https://about.gitlab.com/2018/06/07/keeping-git-commit-history-clean/