Turn off Google Chromes “Switch To Tab” Feature

When I’m browsing, I tend to use tabs a lot. I clean up my tabs when I’m done with them, and I open new ones when I want new ones.

Recently, Google Chrome, introduced a feature which attempts to fix issues of tab proliferation by offering a “Switch to Tab” feature. This feature shows up in the Omnibar when you start typing something in the Omnibar that is similar to a tab you already have open.

It’s an interesting idea, but not useful to me. I find that it negatively impacts my experience using Chrome. Things that use to work (example, right arrow copies selected tab url into current url bar) don’t work with Google Chrome’s new “Switch to Tab Feature”.

I like to think I’m knowledgeable and responsible enough to switch tabs when I want to switch tabs, and open new tabs when I want to open new tabs. That said, I’ll be disabling the “Switch To Tab” feature.

To disable the “Switch to Tab” feature in Google Chrome first find the omnibox-tab-switch-suggestionsΒ flag in the Chrome flags menu. (Psst: it’s here: chrome://flags/#omnibox-tab-switch-suggestions). Then… select “Disabled” from the dropdown options.

Restart Google Chrome and you should be free of that annoying “Switch to Tab” feature πŸ‘πŸ™‚

Clean up Previously Merged Git Branches

First things first, I tend to build up a lot of local branches. No, I don’t pro-actively remove them from my machine. (Who does that extremely smart thing? πŸ™„) At work we use GitHub and Windows. As such I use posh-git to perform almost all my git interactions (you should too cause it’s πŸ‘Œ).

Our current process is:

  1. Create Feature Branch
  2. Create Pull Request
  3. Squash and Merge Pull Request
  4. Delete Feature Branch from Remote

Any developer can have any number of feature branches out at a time waiting to be merged.  As we are using a “Squash and Merge” process our branches are not *actually merged*. We delete the original branch after the squash.

But that doesn’t really matter to you. Come to think of it, it doesn’t really matter to future me. What does matter is, how can I remove local git branches that aren’t on the git remote anymore? (Remote meaning GitHub, Gitlab, Bitbucket, etc…). No, we aren’t talking about the remote tracking branches that are removed by pruning. Otherwise, one could just prune, no?

I continuously search for this, so I’m documenting it here so I NEVER HAVE TO SEARCH EVER AGAIN 😀

First of all, the answer to the question comes from this question on StackOverflow.

git checkout master; git remote update origin --prune; git branch -vv | Select-String -Pattern ": gone]" | % { $_.toString().Trim().Split(" ")[0]} | % {git branch -d $_}

If you are in a position where you Squash & Merge then you will need to replace the git branch -d with git branch -D. This will successfully remove all “:gone” branches from your local machine.

If you are using linux, and not powershell, you can use the following command taken from the same question on StackOverflow.

git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d

But Why?!

Any git branch you have checked out essentially has three branches.
1. The remote branch on GitHub
2. The remote tracking branch on your machine
3. The local branch you do your work on.

When we push a feature branch live (merge a pull request) we delete the “remote branch on GitHub” (#1 above).

When we run `git fetch origin –prune` we remove the remote tracking branch (taking care of #2) above.

However, taking care of #3 above often requires manual clean up. That’s where the piped command above comes into play, it takes care of cleaning up branch #3.