Join GitHub today
Cloning this repository is the same as any with other git repository.
git clone https://github.com/wch/r-source.git cd r-source
To clone the repository without fetching the entire history of the project, you can do a shallow clone, with:
# Get just the last commit git clone https://github.com/wch/r-source.git --depth 1
These are some useful commands on your local clone of the repository:
git branch -a # Show all branches (including remote branches) git checkout origin/R-2-15-branch # Checkout a branch git checkout origin/tags/R-2-15-1 # Checkout a tag (this is how svn tags are represented) git checkout trunk # 'trunk' is the only local branch; it tracks origin/trunk
To get changes, you may need to clean built files from your local checkout before pulling:
# You can do either of the following to clean up: # `make distclean` must be run after ./configure has been run. # `git clean -f` is more aggressive in removing files. make distclean git clean -f # To get changes - just do the usual: git pull # Or do a 'git fetch' to get changes without changing the local checked-out copy: git fetch
Building R from source
Normally, you would do something like this to build R from source:
# Download recommended packages tools/rsync-recommended ./configure make
However, as of revision 62183, R must either be built from a svn checkout, or from the tarball generated by
make dist (which must in turn be built from a svn checkout). Attempts to do otherwise will result in an error.
To work around this, add these commands between
# Download recommended packages tools/rsync-recommended ./configure (cd doc/manual && make front-matter html-non-svn) echo -n 'Revision: ' > SVN-REVISION git log --format=%B -n 1 \ | grep "^git-svn-id" \ | sed -E 's/^git-svn-id: https:\/\/svn.r-project.org\/R\/[^@]*@([0-9]+).*$/\1/' \ >> SVN-REVISION echo -n 'Last Changed Date: ' >> SVN-REVISION git log -1 --pretty=format:"%ad" --date=iso | cut -d' ' -f1 >> SVN-REVISION make
(This is kind of a hack -- there may well be a better method.)
Build instructions for specific platforms
Configuring a git clone to fetch from svn repository
Clones of this git repository can also be configured to get changes from the main R svn repository. This might be useful if you want to get the latest changes to svn that haven't yet been pushed to Github (this repository is updated once per hour).
# Set it up with svn. # Prefix should match remote repo name with a trailing slash git svn init --prefix=origin/ -s https://svn.r-project.org/R/ # Do 'git svn fetch' to fetch changes from the SVN repository. # This will update the git repo, but not change the current checked-out commit. # The first time will take a long time because it needs to match # git commits with svn commits. git svn fetch # This does the same as a fetch, but also updates the current checked-out # files to the latest revision on the branch. Unlike a fetch, it won't add # new branches from svn to the git repository. git svn rebase
There is another r-source repository on GitHub, which has one commit per R release. This can be useful if you're just interested in seeing the changes between versions: https://github.com/SurajGupta/r-source