Recently I found myself in a situation where I wanted to bring in a specific upstream commit into a forked repository. Although these repos share a common history, the two repos had diverged enough that it wasn’t a straight-forward cherry-pick between branches. Instead, with clones of the two repositories I managed to cherry-pick as follows:
To complicate things further, a few days later, I found myself wanting to do the same thing, however, this time a submodule and another file had diverged enough that the patch no longer applied correctly. To get around this I had to:
Finally, I’ve also in recent months found myself wanting to create a completely empty commit to kick off a downstream build process… much like you may touch a file to change its timestamp. To do this you can simply run:
I use a lot of open source software in my research and work.
In recent months I’ve been modifying the source code of some of open source repositories to better suit my needs and I’ve contributed a few small changes back to the DeepLearning4J and the Snacktory projects.
This morning I’m starting to work on a further patch for the DeepLearning4J repository and I needed to bring my local repository up to date before committing the change. However, at some point over the past few months the DeepLearning4J repository has been rebased and my fork of it will no longer merge.
The usual approach for fixing this is to use the command:
git rebase upstream/master
However, for me this produces an error:
git encountered an error while preparing the patches to replay
As a result, git cannot rebase them.
Despite trying on two different computers similar errors occurred.
As I didn’t want to delete my entire repository and create a whole new fork of the upstream master this is the approach I took to fix the problem:
Like any good computer scientist I use git for many research and personal projects. My primary use of git is for code backups rather than collaborating with others. However, in some of my recent work I’ve been sharing repositories with colleagues and students which has caused me to improve my git skills.
The following is some of the functionality I’ve only recently discovered that has been extremely helpful:
git cherry-pick commit-id-number
This command proved very useful when I recently forked a github repo and made some changes to the source code for the specific project I’m working on. I soon discovered a bug in the original repository that a number of users had reported. I was able to fix the bug in my fork, but as my fork had changes that I didn’t want to contribute back to the original repository I was able to use the cherry-pick command to bring across only the specific commit related to the bug fix.
git checkout --theirs conflicted_file.php
Merge conflicts suck. But sometimes despite trying to pull as often as possible they still occur and can full your code with ugly messes to clean up. I recently wanted to throw away my changes to a file and simply use the latest committed file. By using git checkout –theirs I was able to throw away all my changes and go for the file that had been committed and conflicted with my changes. Conversely, you can use –ours to replace the conflicted file in favour of local changes.
During the past few weeks the students in the course I’ve been teaching this semester have used git to collaborate on group projects. The git shortlog command produces a list of commits grouped by each author allowing you to quickly see the relative rate at which people are contributing commits to a repository.
git branch -a
When you clone a remote repository it pulls in all branches from the remote repository. However, if you just type git branch you won’t see this. The -a flag allows you to see everything.
git log --all
The same issue applies when you are trying to see the log across all commits across all branches, just using the standard git log command will only produce the log for the current branch. The -all flag allows you to see the log across all branches, combining this with the cherry-pick command is very useful when you want to bring across just one set of changes rather than merging a whole branch.
git log --all --stat --author="Tom"
Bringing this all together I’ve begun to regularly use the above command to see all commits by a single user across all branches. This has been a good way to measure students’ contributions to a group project (note: the author option is case sensitive).
For many years now I have been using Avast as my anti-virus on my Windows computers. For the majority of that time it has been simple to use and generally non-invasive. However, in the past few months that has dramatically changed.
The first big change has been avast prompting to update software updates for almost every installed application. While this may be helpful for the vast majority of people who do not regularly update their systems, I’ve grown to ignore random pop-ups that say my computer is out of date – because the vast majority of the time they are scams/ads themselves. Saying my system is at critical risk because I haven’t updated an application in the last 24 hours is overkill – especially when the application specific updater isn’t prompting for the update.
Today’s inappropriate interruption from Avast is much more annoying and down right unethical – especially as I did not authorise this behaviour in the application. Below is a screen shot of a produce page from a trustworthy and popular online store I visit on a regular basis.
This is the outline of the problem as given by Microsoft
You install an automatic update for Microsoft Office Word 2007 on a Windows Vista-based computer and then restart the computer. If Word 2007 was running when the computer was restarted, you experience one or more of the following symptoms:
The mouse does not work when you use Word.
You cannot open a Word document from the Search window in Windows Vista.
You cannot open a Word document from Windows Desktop Search.
Word crashes when you try to start or exit Word.
Word crashes when you open the Open dialog box.
Word crashes when you save a document.
Word crashes when you close a document.
The first thing to note is that this problem applies to Windows 7 now as well as Vista. However, the automatic fix it script that you can download to fix the problem will not work on Windows 7 so you have to fix the problem manually (I will get to this soon).
The second thing to note is that the problem was caused by restarting Windows to install updates while Word was still running. There are only two ways this could happen. a) you didn’t close all the programs running on the system before you restarted. or b) Windows Update automatically restarted the system while these applications were running. What happened to me is b) and that is what really annoys me. Sure you can disable automatic installation of Windows Update files. However, I have the feature turned on for the sake of simplicity. If there are critical updates I want them installed. What I do not apprieciate is Windows corrupting itself in the process of installing updates. Furthermore I do not expect a problem with an Automatic Update to still be a problem more than two years after the problem was discovered (this blog on this exact problem is posted September 2007: http://www.edbott.com/weblog/?p=1771)
The fix is simple, but it does involve editing the registery. Something that you are never advised to do unless you have a serious problem with your computer. Hence my anger at Microsoft for stuffing up their own program through an update.
To resolve this problem, delete the HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Data registry subkey. To do this, follow these steps:
Exit all Office programs.
Click Start type regedit in the Start Search box, and then press ENTER. If you are prompted for an administrator password or for a confirmation, type the password, or click Continue.
Locate and then click the following registry subkey:
Okay this is one of those blog posts that tell you something they really should have included in the instruction manual.
When you install Adobe CS4 Web Standard Academic Edition make sure you enter the license key during install.
If you do not do this make sure you switch the language from US English to International otherwise when you try to insert the license key after installation the program will not accept it and the only remedy is to uninstall and reinstall.
Two months ago I got a new computer running Windows Vista Home Premium.
Despite all the warnings about old programs not running, I had no issues with any application, except Macromedia Dreamweaver MX 2004 which would just crash on loading.
When I first got the system I spent around half a day trying to work out how to get it work. But I was unsuccessful.
Yesterday I was loaned a copy of Dreamweaver 8 to use until I went back to full time study next year and get CS3. However Dreamweaver 8 had exactly the same loading issue as 2004.
Now I know that MX 2004 is not supported or expected to run in Vista but 8 is meant to.
So out comes the google searches. I eventually narrowed the problem. Software conflict.
Yep, all of you out there using an Acer Computer will probably have a program installed called eData Security. It will run by default at start up. I never use the program (it is designed for file encryption).
To get Dreamweaver to run just uninstall eData Security and voila Dreamweaver MX 2004 and 8 will run.