With every commit, git records the name of the author as well as the committer along with their respective email addresses. These will be public once you push your project to GitHub. So sometimes it may be advisable to change the email addresses of the author and committer for all the past commits in your repository.
This can easily be verified by running git log.
Thankfully it is surprisingly easy to change the email addresses of author and committer in the repository. Simply run the following command in the toplevel of your working tree:
git filter-branch -f --env-filter "GIT_AUTHOR_EMAILfirstname.lastname@example.org' GIT_COMMITTER_EMAILemail@example.com';" HEAD
Finally just do a push.
git push --force
Note that adding --force is important here, since otherwise the changes will be rejected by the remote with the error message:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'firstname.lastname@example.org:repo/repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Do not do a git pull in that case since that will undo the updating of the author and committer.
If you only want to update the author or committer of some of the commits, you can also use git filter-branch. For instance as follows:
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "to_update@mail" ];
git commit-tree "$@";
git commit-tree "$@";
Note that it is easy for things to go wrong here with providing the multi-line commit-filter – the easiest way is to put this command into a separate script file.
Personally I have only used Revisr, which worked fine for me. However, I am a bit concerned by their website greeting visitors with a warning about an expired SSL certificate. This should really have been fixed by now and is not building my trust in the tool.
WordPress is a powerful platform to just get a simple website up and running. Unfortunately, some things which are considered best practice in software development projects are a bit difficult to realize with WordPress. One of these things is versioning. Thankfully, there is a powerful plug in which enables versioning WordPress using a git repository: Revisr.
As of writing this, one is first greeted by an error message when visiting the Revisr website (something to do with SSL). It is safe to ignore this and to instruct your browser to show this website irrespective of the error message displayed (you won’t be giving any confidential information to this webiste, just browsing around).
In any case, you can download Revisr from WordPress with the following link:
That’s already it for setting up a local git repo that will enable some versioning. However, you can also use this plugin to backup your site and all versions to a remote git repository, for instance using BitBucket. The instructions for this come as follows (assuming you are using an Apache Web server):
Login to your server using SSH with a user with sudo rights
Execute the following
sudo ssh keygen
Follow the prompts to create the key
Execute the following (where /var/www is the root dir of your Apache server)