Open timzaak opened 7 years ago
Good question. I'll look to see if this is possible.
Also, I will say that generally speaking, we don't want merge messages in the history. We want to try to maintain as linear a git history as possible and so we end up using personal forks + rebase squash since it keeps the history cleaner. This isn't important to everyone so I'll look into if we can set GIT_EDITOR=git cz-merge
or something for only the runtime of the command.
@jimthedev thanks.
Looks like we might be able to work on this. Currently if you're working on a merge, you resolve the issues and you try to commit during the merge with this:
GIT_EDITOR="git cz" git commit
then you get this:
/Users/jim.cummins/projects/mytestproj
/Users/jim.cummins/projects/mytestproj
cz-cli@2.8.6, cz-conventional-changelog@1.2.0
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
? Select the type of change that you're committing: fix: A bug fix
? Denote the scope of this change ($location, $browser, $compile, etc.):
imim
? Write a short, imperative tense description of the change:
imim
? Provide a longer description of the change:
imimim
? List any breaking changes or issues closed by this change:
imimim
/Users/jim.cummins/.nvm/versions/node/v6.9.1/lib/node_modules/commitizen/dist/cli/strategies/git-cz.js:102
throw error;
^
Error: Command failed: git commit -m "fix(imim): imim" -m "" -m "imimim" -m "" -m "imimim" /Users/jim.cummins/projects/mytestproj/.git/COMMIT_EDITMSG
fatal: cannot do a partial commit during a merge.
fatal: cannot do a partial commit during a merge.
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
error: There was a problem with the editor 'git cz'.
Please supply the message using either -m or -F option.
Which actually makes sense because you can see that it is adding the filename on the end of the commit message. We probably need a something to look for .git/COMMIT_EDITMSG and modify the command to strip that part of the commit message when we go to do out commit.
One way to do this is to have multiple targets for a commitizen commit. Right now we really just have one target which is running a commit using git commit. We need a second target which takes an adapter's output and writes it to a file. Specifically in this case to .git/COMMIT_EDITMSG.
When I merge from a feature branch into develop
/master
, it'd be great to have the merge commit message be automatically populated with all the commit headers from the feature branch (sort of like a mini change log).
In case anyone has the same use case that I mentioned above, it turns out you can do it with git merge --log=1000
. For example, if you're merging from feature
branch into develop
, the merge commit message will be pre-populated with all commit headers from feature
. If you've been using commitizen
on your feature
branch, the commit headers will be very informative. 1000 is just a large enough number so that all commits on feature
are included.
when I merge a request. I use
git merge --no-ff branch
, then the terminal will show vim and some messages about this commit. how could I integrate git cz with git merge?