Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deron Eriksson SystemML Git Notes

Deron Eriksson SystemML Git Notes

Useful Links


Remotes for SystemML Committers

  • Writable Apache repository: git remote add apache https://git-wip-us.apache.org/repos/asf/systemml.git
  • Read-only GitHub mirror: git remote add apache-github https://github.com/apache/systemml.git
$ git remote -v
apache	https://git-wip-us.apache.org/repos/asf/systemml.git (fetch)
apache	https://git-wip-us.apache.org/repos/asf/systemml.git (push)
apache-github	https://github.com/apache/systemml.git (fetch)
apache-github	https://github.com/apache/systemml.git (push)
origin	https://github.com/deroneriksson/systemml.git (fetch)
origin	https://github.com/deroneriksson/systemml.git (push)

Settings in .gitconfig

[push]
        default = simple
[user]
        name = Deron Eriksson
        email = me@example.com
[alias]
        pr = "!f() { git fetch upstream pull/$1/head:pr-$1 && git checkout pr-$1; }; f"
        systemml-pr = "!f() { git fetch ${2:-apache-github} pull/$1/head:pr-$1 && git checkout pr-$1; }; f"
        systemml-website-pr = "!f() { git fetch ${2:-apache-github} pull/$1/head:pr-$1 && git checkout pr-$1; }; f"
        files-in-commit = "!f() { git diff-tree --no-commit-id --name-only -r $1; }; f"
        delete-last-commit = "!f() { git reset --soft HEAD~1; }; f"
        commit-amend-date = "!f() { git commit --amend --date=\"$(date +%s)\"; }; f"
        log-line = "!f() { git log --pretty=format:\"%<(20)%an (%ad): %s\" --date=short; }; f"
        log-line-since = "!f() { git log --pretty=format:\"%<(20)%an (%ad): %s\" --date=short --since=$1; }; f"
        commit-count-since = "!f() { git rev-list --count master --since=$1; }; f"
        restore-deleted-file-from-last-commit = "!f() { git checkout HEAD^ -- $1; }; f"
        alias = config --get-regexp ^alias\\.
[color]
        ui = true

Creating Pull Requests

  • git checkout -b SYSTEMML-###-Short_description - Create and check out new branch.
  • git add . - Stage your changes.
  • git commit - Commit your changes.
  • git push - Push your commit.
    • This will give you git push --set-upstream origin SYSTEMML-###-Short_description
  • On your GitHub fork, click the green pull request button.

Integrate Pull Request Branch into Master

This can be done with merging or rebasing. Rebasing can cause issues if you're not careful, but if you're careful, it leads to a cleaner history. Read Scott Chacon's Pro Git book for more info.

Simplest Case - Integrate my own branch with single commit into apache master with no merge conflicts

  • git checkout SYSTEMML-###-Short_description
  • git pull --rebase apache master
  • git checkout master
  • git pull apache master
  • git merge SYSTEMML-###-Short_description
  • Verify results:
    • git status
    • gitk
    • git log apache/master..
  • git commit --amend --date="$(date +%s)"
    • Add Closes #PULL_REQUEST_NUMBER. as last line of commit message.
  • git push apache master
  • If there is an update to content in /docs folder, remember to push to gh-pages
    • git subtree push --prefix docs apache gh-pages

Integrate pull request with one commit into apache master

  • git systemml-pr PULL_REQUEST_NUMBER
  • git pull --rebase apache master
  • git checkout master
  • git pull apache master
  • git merge pr-PULL_REQUEST_NUMBER
  • Verify results:
    • git status
    • gitk
    • git log apache/master..
  • git commit --amend --date="$(date +%s)"
    • Add Closes #PULL_REQUEST_NUMBER. as last line of commit message.
  • git push apache master
  • If there is an update to content in /docs folder, remember to push to gh-pages
    • git subtree push --prefix docs apache gh-pages

Squash pull request to one commit and integrate into apache master

  • git systemml-pr PULL_REQUEST_NUMBER
    • check: git log
  • git pull --rebase apache master
    • check: git log
  • git rebase --interactive HEAD~2 - Set the second pick to squash
  • Merge the commit messages. Add Closes #PULL_REQUEST_NUMBER.
  • Amend the commit to update the date. git commit --amend --date="$(date +%s)"
  • Verify results:
    • check: git log
    • check: git log HEAD^..HEAD
    • check: git diff HEAD^..HEAD
  • git checkout master
  • git pull apache master
  • git merge pr-PULL_REQUEST_NUMBER
    • check: git log
  • git push - Nice to preview on my GitHub fork before pushing to apache master
  • git push apache master
  • If there is an update to content in /docs folder, remember to push to gh-pages
    • git subtree push --prefix docs apache gh-pages

GitHub Documentation Updates

Allow others to preview my branch changes on GitHub

  • git checkout SYSTEMML-###-Branch_to_preview
  • Push to my gh-pages branch (renders at http://deroneriksson.github.io/systemml/)
    • git subtree push --prefix docs origin gh-pages
  • Note: If there is an issue on my gh-pages branch, one simple solution is to delete the branch and then push to gh-pages again.
    • Can delete remote gh-pages branch using GitHub web user interface
    • Can also delete remote gh-pages branch with git push origin --delete gh-pages

Update SystemML documentation on GitHub

  • Code has been pushed to apache master (git push apache master)
  • Push to apache gh-pages branch (renders at http://apache.github.io/systemml/)
    • git subtree push --prefix docs apache gh-pages

Main SystemML Website Updates - OLD

There are actually two repositories for the main SystemML website. There is a Git repo that holds the raw code version of the website (markdown files, etc), and there is a Subversion repo that holds the generated version of the website (HTML files, etc).

(1) To make updates, first you need to clone the Git repo and checkout the SVN project:

  • git clone https://git-wip-us.apache.org/repos/asf/incubator-systemml-website.git
  • svn co https://svn.apache.org/repos/asf/incubator/systemml/site incubator-systemml-website-site

This gives me an incubator-systemml-website and an incubator-systemml-website-site project: /Users/deroneriksson/Documents/workspace/incubator-systemml-website /Users/deroneriksson/Documents/workspace/incubator-systemml-website-site

(2) Next I make sure I have the latest versions before working:

  • git pull (in incubator-systemml-website project)
  • svn up (in incubator-systemml-website-site project)

(3) Start Jekyll in raw project directory and specify SVN project as site target directory.

  • jekyll serve -d ../incubator-systemml-website-site/

(4) Make site updates. Site can be seen at 127.0.0.1:4000.

(5) When done, review, stage, commit, and push to Git.

(6) Review and commit generated site to SVN, which publishes site. Remember that when you commit to SVN (there is no push), your results are going to the SVN repository and will appear on the website.


Main SystemML Website Updates - NEW

There are actually two repositories for the main SystemML website. There is a Git repo that holds the raw code version of the website (markdown files, etc), and there is a Subversion repo that holds the generated version of the website (HTML files, etc). Committing to Subversion actually publishes the content.

(1) To make updates, first you need to clone the Git repo and checkout the SVN project:

  • git clone https://github.com/deroneriksson/systemml-website.git
  • svn co https://svn.apache.org/repos/asf/systemml/site systemml-website-site

This gives me an incubator-systemml-website and an incubator-systemml-website-site project:

  • /Users/deroneriksson/Documents/workspace/systemml-website
  • /Users/deroneriksson/Documents/workspace/systemml-website-site

(2) Add remotes, such as

  • git remote add apache https://git-wip-us.apache.org/repos/asf/systemml-website.git
  • git remote add apache-github https://github.com/apache/systemml-website.git

When done, I have

$ git remote -v
apache	https://git-wip-us.apache.org/repos/asf/systemml-website.git (fetch)
apache	https://git-wip-us.apache.org/repos/asf/systemml-website.git (push)
apache-github	https://github.com/apache/systemml-website.git (fetch)
apache-github	https://github.com/apache/systemml-website.git (push)
origin	https://github.com/deroneriksson/systemml-website.git (fetch)
origin	https://github.com/deroneriksson/systemml-website.git (push)

(3) Next I make sure I have the latest versions before working:

  • git pull apache master (in systemml-website project)
  • svn up (in systemml-website-site project)

(4) Start Gulp. For setup instructions, see README at https://github.com/apache/systemml-website

(5) Make site updates. Site can be seen at 127.0.0.1:3000.

(6) When done, review, stage, commit, and push to Git.

(7) Copy/paste contents of systemml-website/_site to systemml-website-site.

(8) Review and commit generated site to SVN, which publishes site. Remember that when you commit to SVN (there is no push), your results are going to the SVN repository and will appear on the website. Typically I do something like:

  • svn status (See what files will be updated)
  • svn add __BLAH__ (Add any new directories or files reported by svn status)
  • svn commit -m "My commit message" (Commit to SVN which publishes the content)

Pull Request Magic

To manually trigger a pull request build, you can type:

Test this Jenkins

To add a user so that the user's pull requests automatically trigger builds, type:

add to whitelist.

To not have a pull request automatically trigger a build, type:

skip ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.