Technology Insights

How To Switch Between Git Branches From The Linux CLI

If you are using Git for version control then it is likely at some point you will have a project with multiple branches of code. The benefit of this is allowing various developers to work on different projects while providing an easier way to merge the code when the developers tasks are completed. One developer may be working strictly on big fixes that could need to be checked in daily while another developer may be working on a project that may take months to complete and git provides a system to merge these code branches together. Below is a quick reference for switching between Git code branches.

Technology Errors

git: Error: Some Local Refs Could Not Be Updated; Try Running ‘git remote prune origin’ To Remove Any Old, Conflicting Branches

Lately I have been working on a Ruby project that has a bunch of different branches that various developers are working on. One of the development servers has multiple virtual hosts and at certain points in the code release cycle the various virtual hosts could be completely split from the main branch of Ruby code either because of a bug fix, a specific feature, or any number of other reasons. The other night I needed to bring one of the virtual hosts to a near production release to test some features of a product that uses the web application to record data and when I attempted to “git pull” I received an error which is described in detail below along with what I ended up doing to resolve the problem.