Setup for Pull Requests

From GnuCash
Jump to: navigation, search

This page gives instructions on setting up your local development environment to use Git, a Github personal account, and your local computer to create Pull Requests (PRs) for updates to GnuCash.

Overview

Submitting changes to GnuCash using PRs involves three pieces: the GnuCash repository, your own Github fork of the main GnuCash repository, and your own local copy, which is a copy of your Github repository. The difference here is your forked copy of the GnuCash repository. By adding this extra repository into the process, you can create branches locally and commit them to your Github copy. From your Github repository, you will then issue a PR to the main GnuCash repository, which the developers can then approve and commit to the final project. This eliminates the need to create patches.

Having your own Github fork requires you to have a Github account, so sign up for one if you haven't got one already and set it up for ssh access.

Note
If you are using Eclipse, the EGit User_Guide Remote of the Eclipse Wiki is useful. It explains also key generation and related steps.

Suggested repository names for Non-Committers Using Pull Requests

Use the following names in your local PC repository for remote repositories:

upstream
The official GnuCash repository to which only authorized developers can write, e.g.
github.com/Gnucash/gnucash or
github.com/Gnucash/gnucash-docs
These are public mirrors for the real GnuCash official repositories.
origin
This is your personal writable GitHub repository, e.g.
github.com/[YOUR-GITHUB-USERNAME]/gnucash or
github.com/[YOUR-GITHUB-USERNAME]/gnucash-docs
Pull requests are made from here to the upstream repository.
Background
origin is the default remote for git push, so it is less typing.
Note
Developers with write access often use a different association:
remote name URL
origin github.com/Gnucash/*
upstream code.gnucash.org/*
mygh github.com/ME/*

Set-Up Your Personal GitHub Repository

Use Github's fork feature to set up a your own personal read-write enabled clone on GitHub:

  1. In a web browser, go to Github, login and search for Gnucash.
  2. Click on the link for the required repository, e.g.
    Gnucash/gnucash or
    Gnucash/gnucash-docs
  3. Click on the Fork button at top right. This will create
    www.github.com/[YOUR-GITHUB-USERNAME]/gnucash or
    www.github.com/[YOUR-GITHUB-USERNAME]/gnucash-docs

Set-Up a Local Repository on your PC

As you will eventually push your modified local repository branch back to your personal GitHub repository, it is useful to create your local PC repository by cloning from your personal GitHub repository, rather than the official GnuCash repository. The remote name origin in your local repository, is automatically set up to point to where you clone from (I.e. your personal GitHub repository).

  1. Create the directory you wish to hold your repository or repositories in and make it current. Assuming you wish it to be called github in your home directory:
    mkdir ~/github
    cd ~/github
    
  2. Clone from your remote personal repository origin:
    git clone git@github.com:<YOUR-GITHUB-USERNAME>/gnucash.git
    
    The clone example above will
    1. create the local repository ~/github/gnucash,
    2. define a remote named origin pointing to the cloned from repository which you can use in future as a shortcut instead of the full URL,
    3. check out the default branch
      maint for program and documentation,
      master for other components in your working directory.
  3. Change into the repository directory:
    cd gnucash
    
    Only
  4. If you wish to work on a new feature which should be applied to the master branch, switch local branch master to track your remote branch:
    git branch --track master origin/master