This practical is designed to give you some practice in creating branches, pushing commits and all things Git with the RStudio Git interface!
Enter the jrgitpractice
project that we have stored locally upon cloning from our remote repository
Have a look at what branches you currently have locally and remotely. What do you think origin means?
r
# origin is the general word used to describe the
# upstream remote repository that has been synced
# with your local copy
Try creating a new branch called dev. Why is it important that we keep the box next to "Sync branch with renote" ticked?
r
# This forces the upstream dev remote branch to
# be formed under the same name as your local
# branch
As things stand, is there any difference between the files in your master and dev branch? Hint: We can check this by inspecting the Git tab in our dev branch
r
# No - we have not yet made any changes or added
# any files to the files already nested within
# the dev branch. We can see this visually by
# observing the fact that there are no files
# ready to be staged for a commit.
hello_myname.R
file by changing "Unknown" to your name. Save it within the jrgitpractice/
directory. Tick the box to the left of your filename. What are we doing here and why does an "M" symbol appear?
r
# We are staging the file in preperation for it
# to be commited. The M symbol stands for
# "Modified". This is telling is that we have
# changed a file that is already stored in the
# project.
Commit the hello_myname.R
file. In doing so, provide a short message describing what commit you have made. Why is this important when working on collaborative projects?
r
# Commit messages are important when working
# collaboratively because it gives collaborators
# a clear understanding of the updates you have
# made to a project. It also serves as a reminder
# to yourself for future reference.
Switch to your master branch. Why are there no commited files?
r
# We have made commit objects in our other/dev
# branch, which is independent of our master
# branch
Switch back to your dev branch. Push your changes to the remote repository. What branch will be created in the remote repository?
r
# A branch with the same name (dev) as your new
# branch will have been created in the remote
# repository. This is because we kept the box
# next to "Sync branch with remote" ticked.
vignette("solutions2", package = "jrGitForMe")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.