rulururu

post Basic branching with git

September 5th, 2008

Filed under: Linux, Software, git — Brenton Alker @ 12:48

With 3 long-running tasks concurrently on my plate, I finally got around to learning branching in git, and it’s easy!

Until this week, I had managed to get by without learning to branch. I have looked previously but got a little lost. I often temporarily stored my work using “git-stash” to work on multiple things at once, but this is very limiting.

So, Here we go. My basic workflow now look like this.

Create a new branch (based on the HEAD of your current branch), and automatically switch to it:

git checkout -b my_branch

Then you can work within this branch as you always would.

Work, work, work…

git add files_i_have_edited.txt
git commit -m 'My changes'

Repeating this step until the task is complete. Then, to get the changes back into the master branch. Switch to it

git checkout master

And pull the changes from the branch

git pull . my_branch

Easy. No need to remember revision numbers where you branched, or which changed have already been merged. You can of course switch back to the branch and continue work with

git checkout my_branch

this “edit, commit, pull” cycle can continue until the task is complete. Then, once you’re satisfied you can delete the branch with

git branch -d my_branch

It’s still in the history of course, but no need to keep old branches around.

Hope that makes things clear to anyone else who was confused as I was by some of the overly complicated explanation of branching in git.

post Set Manipulation of files with uniq & sort

March 22nd, 2008

Filed under: Linux, Operating Systems — Brenton Alker @ 01:24

I often find myself performing operations on single column CSV files to perform tasks such as merging member id lists, or email addresses, counting unique entries, finding duplicates etc.

By applying some set theory (remember that from math class) and some standard linux/unix command line tools, almost any operation I have ever wanted to achieve in this vain is possible. And I have found a post, over at Linux By Examples that provides a simple list of operations and examples of how to achieve them on text files using sort and uniq.

post Manually Deliver Email to Maildir

March 14th, 2008

Filed under: Linux, Operating Systems — Brenton Alker @ 11:12

I have, on occasion, had need to manually drop an email into a users inbox. For example, when an over-zealous virus scanner dumps mail into "quarantine".

After confirming that the email are, in fact, virus free, the emails are able to be injected into the users maildir with the help of safecat, which guarantees atomic copying (even from a slow standard input stream) and unique file naming.

The basic format of the command is:

safecat  .Maildir/new/ < msg.eml


with the only restriction being that tmp_dir must be on the same file system, as the algorithm uses hard links to guarantee instant availability of the complete file.

ruldrurd
Next Page »
Powered by WordPress, Web Design by Laurentiu Piron
Entries (RSS) and Comments (RSS)