Skip to content

Instantly share code, notes, and snippets.

@ttmmghmm
Last active March 27, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttmmghmm/4677e689844ffbf085da to your computer and use it in GitHub Desktop.
Save ttmmghmm/4677e689844ffbf085da to your computer and use it in GitHub Desktop.
packageCreate installPackage gitCmds installR
# https://www.kernel.org/pub/software/scm/git/docs/giteveryday.html
Individual Developer (Standalone) commands are essential for anybody who makes a commit, even for somebody who works alone.
standalone developer does not exchange patches with other people, and works in a single repository, using:
git-init(1) to create a new repository.
git-log(1) to see what happened.
git-checkout(1) and git-branch(1) to switch branches.
git-add(1) to manage the index file.
git-diff(1) and git-status(1) to see what you are in the middle of doing.
git-commit(1) to advance the current branch.
git-reset(1) and git-checkout(1) (with pathname parameters) to undo changes.
git-merge(1) to merge between local branches.
git-rebase(1) to maintain topic branches.
git-tag(1) to mark a known point.
Examples - Use a tarball as a starting point for a new repository.
tar zxf frotz.tar.gz
cd frotz
git init # add everything under the current directory.
git add . <1>
git commit -m "import of frotz source tree."
git tag v2.43 <2> # make a lightweight, unannotated tag.
Create a topic branch and develop.
git checkout -b alsa-audio <1>
edit/compile/test
git checkout -- curses/ux_audio_oss.c <2>
git add curses/ux_audio_alsa.c <3>
edit/compile/test
git diff HEAD <4>
git commit -a -s <5>
edit/compile/test
$ git diff HEAD^ <6>
$ git commit -a --amend <7>
$ git checkout master <8>
$ git merge alsa-audio <9>
$ git log --since='3 days ago' <10>
$ git log v2.43.. curses/ <11>
create a new topic branch.
revert your botched changes in curses/ux_audio_oss.c.
you need to tell Git if you added a new file; removal and modification will be caught if you do git commit -a later.
to see what changes you are committing.
commit everything, as you have tested, with your sign-off.
look at all your changes including the previous commit.
amend the previous commit, adding all your new changes, using your original message.
switch to the master branch.
merge a topic branch into your master branch.
review commit logs; other forms to limit output can be combined and include -10 (to show up to 10 commits), --until=2005-12-10, etc.
view only the changes that touch what’s in curses/ directory, since v2.43 tag.
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download, install and initialize the H2O package for R.
install.packages("h2o", repos=(c("http://s3.amazonaws.com/h2o-release/h2o/rel-kahan/5/R", getOption("repos"))))
# start h2o
library(h2o)
localH2O = h2o.init()
# Finally, let's run a demo to see H2O at work.
demo(h2o.glm)
# installing/loading the package:
if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr
updateR()
# See https://github.com/hadley/devtools#updating-to-the-latest-version-of-devtools
library(devtools)
build_github_devtools()
(x <- getwd())
#### Restart R before continuing ####
# Setwd(“ whatever x was above “)
install.packages("devtools.zip", repos = NULL)
# Remove the package after installation
unlink("devtools.zip")
?devtools::create
path <- file.path(tempdir(), "myDefaultPackage")
create(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment