I get quite tired of having to type out branch names just to change between a branch and master (or another branch) when I need to pull down master and merge it into the branch I'm working on.

I'd like to create a bash script that will checkout the branch I had checked out before the branch I currently have checked out

So if I have two branches `master` and `branch-1` 

```
git checkout master (initial branch) 
git checkout branch-1 (do work on branch-1, but need to merge master changes into branch-1)
git checkout master
git pull (pull master changes) (current branch is master, previous branch is branch-1)
git checkout branch-1 <-- replace this command with a command `git lastbranch` that checks out the branch I had open before this branch

```

Basically I'm just looking for a list of my recent checked out branches, starting with my last branch

So if I've checked out master, and before that I had branch-1 checked out the list will look like

```
master
branch-1
... etc

```

Does any functionality exist?