Skip to content

Instantly share code, notes, and snippets.

View RaghavendraP's full-sized avatar

Anjana Raghavendra P RaghavendraP

View GitHub Profile
@RaghavendraP
RaghavendraP / sync-master-to-branch.sh
Last active May 20, 2021 08:55 — forked from tonylukasavage/script.sh
Move all uncommitted changes to a new branch and revert the existing branch to HEAD."master" has uncommitted changes. You decided you'd rather make those changes in "dev_branch". Here's how to move those uncommitted changes to "dev_branch" and then revert "master" to its last commit.
#### with new branch
# get into the master branch
git checkout master
# create a new branch for the changes and check it out
git checkout -b dev_branch
# stash the changes until we revert master
git stash
@RaghavendraP
RaghavendraP / install-package-version.R
Created March 29, 2018 20:45
Install a specific version of an R package (hack)
# Looks in the CRAN archive for the specified package and version. If
# the specified version is NULL or the same as the most recent version
# of the package, this function simply calls install.packages(). Otherwise,
# it looks at the list of archived source tarballs and tries to install
# an older version instead.
install.package.version <- function(
package,
version = NULL,
repos = getOption('repos'),