`git flow release finish` non-interactively
Asked Answered
T

8

33

How I can use git flow release finish in a manner that doesn't ask for merge commit messages? The -m flag doesn't provide this, as I expected.

The goal of course is to be able to script this in such a way that doesn't require interaction.

Tribal answered 25/1, 2013 at 22:17 Comment(1)
Relevant git-flow bug: github.com/nvie/gitflow/pull/287Quamash
B
42

You can set the environment variable

export GIT_MERGE_AUTOEDIT=no

git flow release finish -m 'Merge Message' release_branch_name

unset GIT_MERGE_AUTOEDIT

It won't invoke the editor for when you merge.

If you switch to my fork git-flow AVH Edition you can set this option to only work for when you use git-flow.

Blare answered 27/1, 2013 at 23:18 Comment(4)
note: use unset GIT_MERGE_AUTOEDIT to turn this off (at the end of your script because clearly if you're reading this question, you're trying to script git-flow)Duckett
The -m merge message is also required, or else the editor will also be presented. And it must be specified before the name of the release branch in the command line arguments.Melisenda
Which version of git is this Abhi? The git documentation does not say you need the message flag: git-scm.com/docs/git-merge/#git-merge---no-editBlare
You can avoid having to unset GIT_MERGE_AUTOEDIT in many shells by only setting it for the duration of the command: GIT_MERGE_AUTOEDIT=no git flow release finish -m 'Finished.' 1.0.0Reidreidar
B
7

I had trouble with the -m flag. However if you give a message without spaces, it worked. Must be a bug.

git flow release finish -m 'my_message_with_no_spaces' 1.2.3
Birthroot answered 26/11, 2013 at 22:13 Comment(1)
I'm running into this too. flags:FATAL the available getopt does not support spaces in optionsReidreidar
I
6

I've finished doing it:

git flow release finish -m "New release:$releaseVersion" -T
$releaseVersion -S $releaseVersion

where -m is the commit message, -T is tag message and -S is squash commit. Now everything is going to work automatically :)

Ivatts answered 9/11, 2020 at 15:24 Comment(0)
M
4

git flow is (more or less) just a wrapper around git commands. Pop open the git-flow-*.sh of your choice, copy the git commands, and then mess with them. In this case, add --no-edit to git merge. This approach kills two birds with one stone: you can just copy these lines into your automation script.

Monosome answered 26/1, 2013 at 7:21 Comment(1)
Love this approach! Makes the change permanent. I also added -m "" to the git-flow-release script to prevent tag messages being requiredBergen
C
2

Unfortunately there's no out-of-the-box way to achieve that with the current version of git-flow.

By looking at the source code, the git command used to merge is

git merge --no-ff

and there's no way to pass the --no-edit flag to it.

A couple of things you could do:

  • fork the project and insert this capability (possibly as an optional flag)
  • propose it as a feature and wait for the dev to implement it
Cursory answered 26/1, 2013 at 4:19 Comment(0)
C
2

You can pass the -m flag to specify a tag message on the command line.

It is still possible for the merges to have conflicts, but the tag operation will not try to open an editor for the tag message.

git flow release finish -m "my awesome release" 1.2.3

https://github.com/nvie/gitflow/wiki/Command-Line-Arguments#git-flow-release-finish--fsumpkn-version

Contend answered 12/7, 2013 at 3:0 Comment(0)
D
1

I don't know about git flow, but if it supports standard git flags, you can use the --no-edit flag to avoid merge commit messages in an automated setting.

Dorcasdorcea answered 26/1, 2013 at 4:2 Comment(0)
A
0

Finally I get this works by this code:

export GIT_MERGE_AUTOEDIT=no
git flow release finish "$newVer" -m "$newVer" -T "$newVer"
unset GIT_MERGE_AUTOEDIT
Allegro answered 25/12, 2021 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.