Oct 3, 2018 - William Chia    

How to work on two Git branches at the same time

Watch the demo on how using the GitLab Web IDE and your local dev environment to work on two branches at once can help save time.

I was recently using both my local development environment and the GitLab Web IDE, and found a really nice workflow for working with two Git branches simultaneously.

The problem

In this scenario, you’re doing development work on one branch, in one part of your codebase, and then likely documenting your process in another place. I really don’t want all of this in one merge request, because I don’t want to delay shipping the development work if the docs aren’t done. I want to be able to get it live so that others can see it, give feedback on each individual component, and iterate on it. At the same time, I don’t want to delay too long on documenting the process, because I want the docs to be as accurate and reproducible as possible.

The fix

While doing my development work in my local development environment, I created another merge request for the documentation using the Web IDE, essentially working on two different Git branches at the same time, using two different editors.

In my quick example below, you can see a merge request to add Jenkins content to our DevOps tools page. I’ve checked out this branch locally, and I have it open in my Atom editor. I’ve been doing some work by updating features.yml, as well as a Markdown file and a Haml file. All of these changes are related to one merge request. While I’m committing changes locally to the comparison page, I’m documenting each step in my Web IDE in a separate tab, to make sure my instructions are precise, helpful, and completed in real time.

Watch the demo

You can see what we've got planned for the Web IDE in 2019 in our post about our product vision for DevOps Create.

What are other ways the Web IDE has come in handy for you? Let us know by tweeting us @gitlab!

Cover photo by Hans-Peter Gauster on Unsplash

Install GitLab in 2 minutes

With Ubuntu, Debian, CentOS, openSUSE, and Raspbian packages or from source

Install GitLab Now