Serhioromano / vscode-gitflow

Git Flow extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=Serhioromano.vscode-gitflow
MIT License
40 stars 8 forks source link
git git-flow git-flow-avh gitflow version-manager versioning vscode vscode-extension

Git FLow Support for VS Code

Attention!!!. From version 0.5.11 it requires latest VS Code >=1.64.0.

Looking for an artist to contribute the extension icon.

Known Issues

  1. On MAC you might need to configure gitflow.path parameter to /usr/local/bin/git-flow.
  2. If you name your branch folders with capital letters like Feature instead of feature, things break due to a bug in the git-flow extension of git CLI command. Please make sure you name your branch folders with lower-case names.
  3. When VS Code opens a Windows directory while on a remote WSL, sometimes this might cause problems. But who is gonna do that, right?
  4. When authentication is not configured, commands that make push to remote commands may fail. (see: How to setup)

What is Git Flow

Git Flow is an abstract idea of a Git workflow. It helps with continuous software development and implementing DevOps practices. The Git Flow Workflow defines a strict branching model designed around the project release. This provides a robust framework for managing larger projects.

Git Flow is ideally suited for projects that have a scheduled release cycle and for the DevOps best practice of continuous delivery. It assigns very specific roles to different branches and defines how and when they should interact. It uses individual branches for preparing, maintaining, and recording releases.

Read more.

How to use

When installed, you will find 2 new views in SCM side bar, GITFLOW and VERSIONS. Also in status bar you will find Git Flow button to launch Quick Pick menu, or you can use Shift+Alt+D short key.

To see list of all commands use F1 or Ctrl+Shift+P and type GitFlow.

ext.

We suggest Git Graph to complement this extension.

Features

All basic operations you need to do in a single place.

GitFlow

Additional

Options

Feature Details

Multiple Folder Workspace

Multiple folder workspace was long awaited feature of VS Code for many people. It would be a shame not to support it.

GitFlow multiple folder workspace

Quick Pick

Quick Pick is a popup with essential Git Flow commands, like creating a new flow branch or applying actions to the currently selected flow brunch. You can call it with Shift+Alt+d short key. Note this command is available only if extension was initialized successfully.

Git flow quick pick

Automatic version bump

This extension can automatically update your package.json file on creating a new tag - but only on release and hotfix branches. When you create one, as a name use version standard. For example create a 1.0.1 release which will result in a release/1.0.1 branch. The version property of package.json will be updated to 1.0.1 and automatically committed to git.

Automatic changelog update

This extension can automatically update your CHANGELOG.md. If you have there something like

## [Unreleased] - yyyy-mm-dd

or

### [UNRELEASED] (DD-MM-YYYY)

Or any combination of [Unreleased], [unreleased], [UNRELEASED], yyyy, mm or dd and all uppercase variations, these will be replaced with the relevant info.

How to work with Support branch

What is Git Flow Support branch for?

Support branches are similar to LTS version of Linux distros.

In the git-flow model, your latest released version actually maps to the master or main, while your "preview release" maps to a git-flow release branch. It is forked from develop and finally merged into main when the actual release happens. Then this will become your latest release and you will usually fix only bugs for that release, using git-flow hotfix branches. In this way, your main always represents the most stable state of your latest released version.

Say you had a project, and you were happily releasing new versions. Maybe your current production version was 8.x. But you had some Really Important Customers who refused to upgrade to anything after 6.0. Now, if someone found a security flaw in the 6.0 version of your project, it would be a bad idea to hang all those Really Important Customers out to dry. So you release a new hotfix against support/6.0, even though all their problems would be solved if they just upgraded to the new 8.x release.

For this to happen you have to create support/6.0 at some point of time. Basically you can create support branch on all major version change.

Workflow

First create your support branch. When you create you can select the tag version to start from. Use the latest version in major set.

Now if you checkout any support branch, no matter what you start - hotfix, release, bugfix or feature - you will be prompted to confirm to start it based on currently active support branch. And if you started it based on support branch, when you finish your hotfix, release, bugfix or feature, it will be finished against that support branch and not to main or develop branches.

Thus your master or main branch contain most recent version of your product and support branches have major LTS versions.

How to setup

Working locally

  1. VS Code should be open on a folder not file
  2. Git must be installed.
  3. Root folder must be a git repository. If not run git init command in the terminal.
  4. Git Flow must be installed.
  5. You have to initialize git flow in the root of your repository with git flow init command.

Working remotely

In order to push branches to or delete branches from a remote repository like GitHub, you must be authenticated. For GitHub there are 2 main ways to work with repositories - over SSH protocol or over HTTPS. Those 2 different protocols usually refer to repository with different URL. Here is example of the SSH and HTTPS URLs for this extension.

https://github.com/Serhioromano/vscode-gitflow.git
git@github.com:Serhioromano/vscode-gitflow.git

You can clone a repository with either URL.

SSH (recommended)

First ensure your repository is configured to work over SSH.

git remote remove origin
git remote add origin git@github.com:user/repository.git

Or simply edit your_repository/.git/config and make sure repository URL there has a SSH link.

Read this article for how to authorize your PC with SSH key.

Basically what you have to do is to generate key with

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Then go to ~/.ssh folder and look for id_rsa.pub file and copy it's content. Lastly go to https://github.com/settings/keys and add SSH Key there.

HTTPS

First ensure your repository is configured to work over SSH.

git remote remove origin
git remote add origin https://github.com/user/repository.git

Or simple edit your_repository/.git/config and make sure the repository URL there has a HTTP link.

Now you need to cache your credential. Use the GitHub CLI.

GitHub CLI will automatically store your Git credentials for you when you choose HTTPS as your preferred protocol for Git operations and answer "yes" to the prompt asking if you would like to authenticate to Git with your GitHub credentials.

Changelog