Another couple of git tips, that might conceivably be useful to someone somewhere :)
git makes it so easy to create topic branches, that it’s easy to lose track of which branches were for what. Here are a couple of recipes that might help with this:
Order branches by last commit date
I often want to order my branches according to how recently I was working on them. We can approximate that by saying we’d like to order the branches by the commit date of each branch tip, and you can do that with git for-each-ref --sort=committerdate. For example, the shell script:
for C in $(git for-each-ref --sort=committerdate refs/heads --format='%(refname)')
do
git show -s --format="%ci $C" "$C"
done
… produces output like this:
... 2011-02-23 18:57:01 -0500 refs/heads/trainable-seg-gui 2011-03-09 11:25:38 +0100 refs/heads/snt-swing-menus3 2011-03-11 00:44:37 +0100 refs/heads/master
Show branches that introduced changes to particular paths
If that doesn’t turn up the branch I’m looking for, it might be useful to just list those branches that made changes to particular paths (with respect to master). Here’s a similar example of how to do this, in this case looking for all those branches that introduced changes to the path src-plugins/Simple_Neurite_Tracer:
P="src-plugins/Simple_Neurite_Tracer"
for C in $(git for-each-ref --sort=committerdate refs/heads/ --format='%(refname)')
do
git diff master..."$C" --quiet -- "$P" || echo $C
done
… which produces output like this:
... refs/heads/sholl-analysis refs/heads/for-rebasing refs/heads/sholl-analysis-wip refs/heads/sholl-analysis-wip2 ...
Ordering branches by the last time the branch was changed
This came up in a Stack Overflow question – sometimes you might want to know when the branch pointer was last changed, not the date of the last commit. Jefromi’s answer provides a nice recipe that you could alter to order the branches in that way.
Mark,
I’m trying to extend the range of a BT Home Hub 3 using a TP-Link WA701ND, and following your instructions — and I’m struggling.
Firstly, you say: “Find an ethernet cable, and use that to plug a laptop into the TP Link device.”
I do that, but I’m uncertain what the purpose of it is. I can’t see the ethernet connection to the TP-Link, only the wireless connection.
“Configure the laptop to have a static IP address of 198.168.1.100″
Does it matter whether I use the properties box of the TP-Link or the HomeHub?
Either way, setting the above makes it impossible to visit http://192.168.1.254. I can’t get a connection.
The only way I can get a connection, is to reset the static IP address to automatic, but then I can’t access the TP-Link configuration page.
Catch 22
Any advice would be much appreciated. I’m sure I’m doing something silly, but setting up networks is not my forte.
Thanks
John Davidson