Hitachi Vantara Pentaho Community Wiki
Child pages
  • Developing with Git source controlled projects
Skip to end of metadata
Go to start of metadata

Git Configurations

Here are some suggested tweaks you can make to the base git configuration.

~/.gitconfig
[alias]
  ci = commit
  st = status
  br = branch
  co = checkout
  df = diff
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

[core]
  # WINDOWS
  # autocrlf = true

  # Mac or Linux
  autocrlf = input

Developing for Pentaho with Git

Pentaho is in the process of migrating all active projects from Subversion to Git hosted on GitHub.com. You can track which projects have been migrated, see their old and new locations at Git Migration List

Tips and tricks

Avoid the issue where you have modified files that you don't want to prevent you from "pull"'ing in new code.

Thanks to Tim Kafalas for this one

Git detects .classpath as local changes and will not allow a “pull” while these changes are present in your working folder. One way to get around this is to stash the local changes, do the pull, then pop the stash. There is another way, however, that will not stress out Eclipse with a re-index.

By default, Git uses a bit in git metadata to determine if a file has changed. This is much more efficient than actually comparing the contents of the file.

The command…

git update-index –-assume-unchanged {myClassPathFile}

… will reset that bit so that it looks like the file is unchanged. So if you issue this command for each classpath file you should never have to stash them again.

This bit can be changed in Egit by selecting Team -> Advanced -> Assume Unchanged on the file in question.

Note that this setting will “stick” until turned off manually, or until you re-clone the repository. So don’t use it on files you have changed but don’t want to commit yet, unless you are prepared to manually set the bit afterword.

Ignore whitespace when viewing pull requests on github

Github easter egg: add ?w=0 to diff URLs (eg a commit, compare view or pull request) to ignore whitespace

Good article on pull request best practices:

http://codeinthehole.com/writing/pull-requests-and-other-good-practices-for-teams-using-github/

Get Git

Follow the instructions for your environment here:
http://git-scm.com/

git-completion

For the linux/mac users, there is a nice script available called git-completion that provides auto-completion of git commands, branch names and other helpful things. It also provides a way to display the active branch on your commandline prompt.

Download the appropriate git-completion script (https://github.com/git/git/tree/master/contrib/completion) and put it in your ~/bin folder. Then source this file in your .profile or .bash-profile. To add the active git branch to your prompt, set your PS1 setting (for the display prompt on a terminal) to something like this:

PS1='[\u@\h \w$(__git_ps1 " (%s)")]\$ '

Sign-up for a GitHub account.

http://github.com

Accessing Pentaho code hosted on GitHub

All projects migrated to Git are hosted on the Pentaho organization: https://github.com/pentaho

Contributing code

Pentaho has no special procedures for working with our GitHub repositories. Follow the general workflow and instruction on GitHub:
https://help.github.com/

When you're ready to submit code with a Pull Request, create a Jira case and use the case number in your commit messages, e.g. "[JIRA-1234] adding new functionality". When submitted update the Jira case with a link to the pull request on GitHub.

Advanced Topics

Advanced Git Topics - Preferred workflow, get yourself out of git trouble, and other cool stuff

Other Resources

  • No labels