git rebase master

and you get conflicts. Here’s how to proceed:

1. fix conflicts

Look for CONFLICT and edit the file mentioned. Note: the path is to the root of the git repo not where you are currently

2. git add <conflicted files>

3. git rebase –continue

Once you’ve merged and do a git status I got:

This would be because I’d already pushed my feature branch. i.e. you’re changing the history of all those commits by doing the rebase

The solution is, assuming you’re the only one using your feature branch, is to force push.

A trick to make this less dangerous is to use git push --force-with-lease rather than git push -f. This way if someone did get hold of your feature branch and push a change it would fail instead of overwriting the new commit.

However the golden rule is – don’t use rebase on public branches. If you’ve pushed then


More here:

and here:



Note: If everything goes wrong:

git rebase –abort

How do you copy a directory?

This is one of the most basic tasks you can do.

But it’s fraught with complexity.

The obvious requirement here is I want to copy a directory exactly as it is from A to B.

So, let’s try this on the Mac (note: this will be different if you’re on Linux):

cp -r 

I had symlinks so I got:

cp: some/directory/structure: No such file or directory

Let’s check man cp.

so cp -r does not copy symlinks.

Note: I use tldr which incorrectly says:


Why? ‘cos if we look at -Pwe see:

So that’s not going to work.

OK, moving on. Let’s look at -R. Seems more like it.

On a large directory this took forever though. As an alternative, let’s try:

rsync -pvzar

Hmm. Measuring the time this took on a large directory (14 G), rsync was 50% slower.


More notes:

Should you have a trailing slash? On the source directory? The destination directory? Both? None?

You need the trailing slash on the source directory but the destination is optional. i.e. both of these work:

cp -R source/ destination/

cp -R source/ destination

but this:

cp -R source destination

would copy source into the destination directory.


cp -R source/* destination

would not copy dot files to destination.


A trailing / at the end of a pathname forces the pathname to refer to a directory.





Split terminal:

  • horizontally: Ctrl b "
  • vertically: Ctrl b %

Move between panes:

  • Ctrl b <arrow key>

(although this interfered with a Mac keyboard shortcut)



Ansible: Proxy using ProxyCommand


curl: PUT

Testing curl PUT commands.

Start by creating an HTTP PUT server:

and run with python


curl -XPUT -H "Content-Type: application/json" http://localhost:8000 -d '{"test": null}'

and now you can mess around creating arbitrary PUT commands.


  1. spaces don’t matter between -H and quotes.


is the same as:

-H "Content-Type

2. Double quotes == Single quotes. E.g.

-H'Content is OK

3. argument to -dmust be surrounded in quotes. E.g.

-d 'test=test' is OK.

-d test=test is NOT OK.

E.g. see examples here:


Will restarting sshd disconnect you?

Say you’re on a bastion host and want to restart sshd with:


Is it going to disconnect you?


What you will see if you’re tailing /var/log/auth.log is:


AWS: reliable? It ain’t!

Let me caveat that.

There’s some idea that stuff is bulletproof once on AWS. It’s not.

AWS has internal issues as do any provider. E.g. network problems (remember that S3 EOF bug?), disk drives failing (Retirement Notifications anyone?), etc

On top of that, stuff will hit internal inconsistencies. E.g. you have an ASG which tries to launch an EC2 instance only to fail ‘cos you’ve reached your limit for that particular type of EC2 instance.

But you can build around it in your app with Error Retries and Exponential Backoffs (techniques probably more familiar to mobile developers):


E.g. here’s a solution Terragrunt uses: