Open main menu

Gramps β

A Translators Guide to Git

Revision as of 13:49, 4 January 2019 by Nick H (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Contents

Configuration

Git includes your name and email address in commits. To configure them, use the following commands:

git config --global user.name "John Smith"
git config --global user.email [email protected]

Git will automatically convert line endings for you. Use the following settings:

git config --global core.autocrlf true  # Windows
git config --global core.autocrlf input  # Linux/Mac

The following configuration option simplifies pushing a branch back to the server:

git config --global push.default upstream

Obtain a copy of the repository

Clone the repository:

git clone [email protected]:gramps-project/gramps.git Gramps

Change directory:

cd Gramps

Create a maintenance branch

To create a local branch which tracks a branch on the server, use:

git checkout -b gramps50 origin/maintenance/gramps50

Updating a translation

Basic workflow

Checkout the maintenance branch:

git checkout gramps50

Get the latest changes:

git pull --rebase

Now edit the po file.

Check status and differences:

git status
git diff

Stage the file for commit:

git add po/xx.po

Commit the change:

git commit -m 'Update xx translation'

Get the latest changes again:

git pull --rebase

Always use the '--rebase' option.

Check the log:

git log

Check using a graphical tool:

gitk

Look for anything unusual such as merge commits.

When you are completely happy, push the changes to the server. If in doubt, don't.

Creating a pull request

Create a PR if you do not have write access to the repository, or if you want someone to check your work.

Fork the Gramps repository in GitHub.

Create a remote to access you fork:

git remote add myfork [email protected]:<username>/gramps.git

where <username> is you GitHub username.

Create a branch to work in:

git checkout -b xx gramps50

Now edit the po file.

Commit your changes:

git add po/xx.po
git commit -m 'Update xx translation'

You can update the gramps50 branch at any time.

git checkout gramps50
git pull

You rebase your working branch on the gramps50 branch at any time.

git checkout xx
git rebase gramps50

When you are ready to make a pull request, push your translation to your fork:

git push myfork xx

Now create a pull request within GitHub.