Looking for how to convert a Bazaar repository to Git?
Project Migration Status
|Debian package||Migrated||superfly||Might migrate package into Debian itself|
|FTW data||Unmigrated||superfly/phill||Need to assess what needs to be done|
|Wiki||Migrated||trb143||Needs clean up|
|iOS remote||Unmigrated||Daniel/superfly||Need to figure out what needs to be done|
New to Git
Moving to Git from Bazaar
Compared to Bazaar and some other version control systems, Git is a little obscure and inconsistent. The following directions will help to make Git easier to use.
Copy and paste the following snippet as
~/.gitconfig on Linux and macOS, and
%USERPROFILE%/.gitconfig on Windows:
[user] name = Your Name email = email@example.com signingKey = <your gpg key signature> [commit] gpgSign = true [alias] br = checkout -b co = checkout ci = commit -a st = status pum = pull upstream master pom = push origin master rbm = rebase master
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 manual for creating your keys. Once you've created the keys, set your GPG key in
.gitconfig file, and set
true. Use the following command to get a list of 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 <firstname.lastname@example.org> sub rsa4096 2023-01-01 [E]
The long hash (
AB0ED2D509706C94196F78FC3CB14F7C94A37597) above is your key signature.
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
[gpg] program = gpg2
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 <your gpg key signature>
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
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 above:
$ git br <branch name>
To switch to an existing branch, you need to use the
checkout command, or the
co alias in the config above:
$ git co <branch name>
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 Mercurial:
$ git ci -m "Added more silly comments"
Adding new files remains the same, you need to use the
$ git add <my new file> $ git commit -m "Added my new file"
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:
git remote add upstream https://gitlab.com/openlp/openlp.git
Then, whenever something is merged into upstream master:
git co master git pull upstream master git push origin master git checkout <<your-branch-name>> git rebase master (Now fix your stuff) git push origin <<your-branch-name>> --force
If you're using config file above, you can use the following aliases:
git pum git pom
Rebase vs Merge
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 way.