One of the nice (but optional) parts of using Git is that you can sign
your commits with your private GPG key. This ensures that you are the
one who is making those commits, rather than some bad actor pretending
to be you.
To set up your GPG keys for signing, follow the instructions in the Git
creating your keys. Once you've created the keys, set your GPG key in
your .gitconfig file, and set gpgSign to true. Use the following
command to get a list of
$ gpg --list-keys gpg: checking the trustdb gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 3 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 3u gpg: depth: 1 valid: 1 signed: 0 trust: 1-, 0q, 0n, 0m, 0f, 0u gpg: next trustdb check due at 2020-04-26 /home/user/.gnupg/pubring.gpg -------------------------------- pub rsa4096 2018-01-01 [SC] AB0ED2D509706C94196F78FC3CB14F7C94A37597 uid [ultimate] Your Name <email@example.com> sub rsa4096 2023-01-01 [E]
The long hash (AB0ED2D509706C94196F78FC3CB14F7C94A37597) above is your
If your operating system ships with GPG2 as gpg2 (I'm looking at you,
Fedora), then you'll want to add the following extra snippet to your
Once you've set Git up for signing, you need to add your GPG key to your
profile in GitLab. First, export your key:
$ gpg --export -a
Then go to the GPG Keys page in
GitLab and add the output of the previous command as a key.
Now you should be good to go.
Unlike Bazaar, Git doesn't come with aliases by default. The config file
above has a couple aliases that might be useful to you in your workflow,
such as co for checkout and st for status
In Git, branches are held within the same directory as the repository,
compared to Bazaar which favours branches in separate directories. To
create a new branch, based on the current commit in the current branch,
you can either use git checkout -b <branch name> or git branch <branch name>. You can also use the br alias from the config file
$ git br
To switch to an existing branch, you need to use the checkout command,
or the co alias in the config above:
$ git co
Committing and Staging
Unlike Bazaar, Git won't automatically commit any changes you have made
when you run the commit command. You have to first add the files you
want committed to the Git staging area through the add command. If you
don't want to have to use two commands to achieve what you previously
did with once, use the aliases in the config above and type the
following to get the same effect as using commit in Bazaar or
$ git ci -m "Added more silly comments"
Adding new files remains the same, you need to use the add command:
$ git add $ git commit -m "Added my new file"
PyLint on Commit.
Run pip3 install git-pylint-commit-hook
Find the ./git/hooks directory and mv pre-commit.sample to pre-commit.
Replace the contents of the file with
Now PyLint will run on the files you commit.
Changes and Updates.
All changes are developed in a branch of a users fork of the upstream master.
To add changes back into a development branch from the master run the following commands.
Once per branch
There is much debate in the Git community on rebase vs merge. If you
don't know what this is about, don't worry about it. For those that do,
OpenLP doesn't care either, and we will accept merge requests either