When porting modules from Drupal 7 to Backdrop CMS, it's natural for people to download the Drupal project as usual, and then start to make changes to the code so it will work for Backdrop. When they have got a working Backdrop version of the module, they are often inclined to contribute it back to the Backdrop community -- which is great!

One of the three minor requirements for a ported Drupal project to be included in the Backdrop contrib-group is that the Git history be included from the Drupal project.

The most important reason we want to keep the history is because we want all the Drupal contributors to get credit for all the hard work they have done on the project. Keeping the history can also make it easier to cross-port fixes from the Drupal project, or even maintain both projects at the same time.

To check if your Backdrop project contains the Git history from Drupal, check the Git log in reverse order to see the oldest commit first.

git log --reverse

What should you do if you are missing the Git history?

In the commands below, I'll use the project module as an example.

The first thing you need to do is set up a new local repository that is a clone of the Drupal project.

git clone https://git.drupalcode.org/project/project.git

Remove the Drupal tags. The backdrop project will have it's own tags for release.

git tag | xargs git tag -d

Create a new Backdrop branch that matches the Drupal branch. For example, if you started with the 7.x-2.x branch of project module, the backdrop branch would be named 1.x-2.x.

git checkout -b 1.x-2.x

Connect this clone to your Backdrop project (probably on GitHub), by adding the Backdrop repository as a second remote.

cd project
git remote add backdrop git@github.com:backdrop-contrib/project.git

Pull in all the changes from the Backdrop project, by using the --allow-unrelated-histories option.

git pull backdrop 1.x-1.x --allow-unrelated-histories

This will likely result in merge conflicts. Work through each file ensuring that the changes you made to get the project working for Backdrop are preserved. When you're done, accept the corrections by running git commit.

To confirm that your project now contains the Drupal history, check the log in reverse order again.

git log --reverse