10 Pushing it online
We’ve got all this locally, and that’s great, now it is time to share it with the world!
If all went well with installation, then there are two steps to making this available publicly.
- Set up git
- Push to github
10.1 use_git()
We can establish a git repository with:
use_git()
Which does:
- initialise a git repository
- asks you to commit files
- other setup
- May ask you to restart RStudio to establish the git pane
- Make a small change to the praise function to change the compliment used.
- Unpack the git pane
- Unpack diff changes
use_git()
- Run
usethis::use_git()
and follow prompts - Explore the git pane
- Explore making changes to files and seeing changes in git
- Notice that you can commit, but you cannot “push”
- Generally, you want to finish the sentence, “this commit will…” as a way to structure your commit messages.
- Demo emoji github lookup, so you add fun things like rockets to your commit messages: https://gist.github.com/rxaviers/7360908
After git is set up, we want to put it somewhere online. In this instance, we want to use GitHub, but other alternatives exist, such as codeberg, gitlab, and bitbucket.
10.2 use_github()
The usethis
package really does make our lives enormously easier here. They’ve got a little handy function called use_github()
which does the following key things:
- ensures the project uses git
- creates the repo on github
- pushes it to github
This saves us a bit of time, and honestly, feels like a bit of magic.
There’s a lot of things about github!
- issues
- releases
- milestones
- projects
What questions do you have about github from here?
10.3 How to use git and github
For the most part, we want to follow this process:
- Make changes to package
load_all()
- Ensure it works as expected, through informal/formal testing
- Select changes
- Write commit message
- Push to github
Remember this phrase:
commit early, commit often.
10.4 Up next: README
Up next, let’s add a README, so we can share a small example of how to use our package!