There are 4 main parts to Git Workflow:
Already completed?
RStudio
Gui (clunky though)usethis::create_github_token()
gitcreds::gitcreds_set()
? Enter new password or token
, paste PAT to setgh::gh_whoami()
to check if setFork
: to make a copy of a repo in your own GitHub account
Clone
: make a copy of the your GitHub repo on your local computer. * copies a remote repo to create a local repo with a remote called origin automatically set up.
Pull
: incorporates changes into your repo from remote
Add
: adds snapshots of your changes to the “Staging” area.
Commit
: takes the files as they are in your staging area and stores a snap shot of your files (changes) permanently in your Git directory
Push
: uploads your files (changes) to the remote repo
Status
: checks the status of a repo changes, etc.
Merge
: incorporates changes into the branch you are on.
Pull Request
: By “issuing a pull request” to the owner of the upstream repo, you are requesting that your changes be pulled into their repo (accept your changes/work).
At the Terminal in RStudio
$ git status
git pull
git add
git commit -m "description of changes"
git push
$ git add <file>...
such that <file>
refers to the file name
file might be in a directory, e.g., r/
$ git add r/yourname.R
Tab to auto-complete, e.g., git add r/you{TAB}
$ git add .
git commit
is used to commit the changes-m
to tell git you want a message (e.g., "my message here"
)$ git commit -m "added my first .R file"
$ git push
$ git pull
If interested, see gittower YouTube