How to fix Apt-Get package manager when it’s broken.

Written by Jason Shultz on March 15, 2014

If you see something like this on your terminal when you’re doing an update or install then you’ll know you have a problem.

sudo apt-get install 

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/toolbelt.heroku.com_ubuntu_._en
E: The package lists or status file could not be parsed or opened.

Fortunately, it’s really to fix it. To do that simply:

sudo apt-get clean 
cd /var/lib/apt 
sudo mv lists lists.old 
sudo mkdir -p lists/partial 
sudo apt-get clean 
sudo apt-get update

And that’s all there is to it! I hope this helps.

How do I keep my forked github repo up to date?

Written by Jason Shultz on March 13, 2014

It’s easier then you might imagine.

First, start with your forked repo and clone it to your local machine.

git clone
cd awesomefile
git remote add upstream

What we did is first, cloned our local repo to our machine. Then, we added a remote branch called upstream and linked it to the original repo that we forked from.

Now, we’re going to get (in the master branch) the changes from the original repo and rebase them into our master branch. We’ll do that like this:

git fetch upstream
git rebase upstream/master

And that’s it. Pretty simple, right?

Why is git pull a bad idea?

Written by Jason Shultz on March 12, 2014

If you’re like most of us, you don’t think much about pulling the remote branch you’re currently working on and keeping it up to date. How many times do you sit at your desk and type:

git pull origin develop

But is that the best way to be doing things? Consider this:

  1. it introduces unnecessary nonlinearities in the history
  2. it makes it easy to accidentally reintroduce commits that were intentionally rebased out upstream
  3. it modifies your working directory in unpredictable ways
  4. pausing what you are doing to review someone else’s work is annoying with git pull
  5. it makes it hard to correctly rebase onto the remote branch
  6. it doesn’t clean up branches that were deleted in the remote repo

What would a better alternative be? I propose adding this alias to your git config:

git config --global alias.up '!git remote update -p; git merge --ff-only @{u}'

But, what does this do, you ask? I’m glad you asked, some might even say, “excellent question!”

This alias downloads all of the latest commits from all upstream branches (pruning the dead branches) and tries to fast-forward the local branch to the latest commit on the upstream branch. If successful, then there were no local commits, so there was no risk of merge conflict. The fast-forward will fail if there are local (unpushed) commits, giving you an opportunity to review the upstream commits before taking action.

This still modifies your working directory in unpredictable ways, but only if you don’t have any local changes. Unlike git pullgit up will never drop you to a prompt expecting you to fix a merge conflict.

Too Many Online Media Choices?

Written by Jason Shultz on March 10, 2014

I know, I shouldn’t complain. But check this out. I’ve Amazon Video, which doesn’t work on my tablets but does work on my Xbox One and Tivo. I’ve got Xbox Video/Music which works on Xbox One (shocker) and that’s it. I don’t know which one to use, really. And there’s Google Play which lets me buy music and video and I can cast it to my xbox and tivo AND it works on all my devices. It would seem, I guess, that Google Play would be the best bet. But not really. I really like being able to just tell my xbox what to play and it’ll play. But is that really a big enough reason to use it?  Amazon seems to be the most restricted since Android I can just cast it to whatever device I want. What do you think? So, to break it down:

Google Play

ChromeCasts to anything with Youtube or ChromeCast Dongle. Doesn’t have native apps beyond Youtube on most devices. But it obviously works on all my mobile device which is a big selling point.

Amazon Video

Native Apps on many devices (except Android). Can’t “cast” to other devices. Unlikely to ever see a native app on Android.

Xbox Live

No native apps that I know of beyond Xbox Live Music. You can use voice commands on Xbox One to play things (which isn’t a strong selling point but is kind of cool).