Skip to content

How to supply single commit message for multiple repos? #184

Closed

Description

@furious-luke

🤓 Question

When running meta git commit I'm asked to supply a commit message for each sub-project individually. Quite often I want to supply the same, lengthy commit message to all projects. Is there a way to ask meta to use just one commit message for all commits?

Activity

  1. patrickleet commented on Jul 25, 2019

    @patrickleet
    Collaborator

    same as git commit

    to append a message it's git commit -m 'fix: the fix was made'

    in meta, just prefix the same command with meta

    meta git commit -m 'fix: the fix was made'

  2. mateodelnorte commented on Jul 25, 2019

    @mateodelnorte
    Collaborator

    This is where meta shines.

    meta git add .
    meta git commit -m "my commit message"
    meta git push
    

    git is smart enough to perform no-ops on any repos that don't have changes.

  3. furious-luke commented on Jul 26, 2019

    @furious-luke
    Author

    @patrickleet @mateodelnorte The issue with using "-m" on the command line is that my commit message is rather long. I tend to include significant detail in my commits, so writing on the command line is pretty inconvenient. I could type out the commit message in a separate file and then supply it with "-F", but again, it's not quite the same workflow I'm used to. What would be amazing is an option to "meta git commit" that popped up my editor to enter a commit message, but then used that commit message for all subrepos.

  4. mateodelnorte commented on Jul 26, 2019

    @mateodelnorte
    Collaborator

    That would be a pretty complex operation, I imagine. Perhaps it might be possible to write to open $EDITOR and save to known file locations? Care to look into it and let us know what you find?

  5. furious-luke commented on Jul 26, 2019

    @furious-luke
    Author

    Yeah for sure, I'll have a poke around today and see how difficult it looks. Thanks for the help!

  6. furious-luke commented on Jul 26, 2019

    @furious-luke
    Author

    Hey again @mateodelnorte, I've forked your meta-git repo and added a branch that I think goes most of the way to adding the feature, take a look here: https://github.com/furious-luke/meta-git/tree/feat/single-commit

    The commit message on that branch describes a little of the mechanism I used, but it's largely as described in your comment above. The issue remaining to be resolved is the trigger for activating the single commit mode. Right now it checks if the -F flag has been provided to the commit command, and if it has a value of same it opens an editor and uses the results of that for all subrepositories. Of course this isn't ideal, "-F same" is a bit strange. The reason I wanted to make it an overload of the -F flag is that it doesn't make sense to enter a single commit mode and also supply a file for use with -F; overloading it like this makes that impossible.

    What are your thoughts?

    P.S. I wanted to use something like -F - which I think would be cleaner, but it looks like command line argument processing strips away the trailing -.

  7. mateodelnorte commented on Jul 29, 2019

    @mateodelnorte
    Collaborator

    You don't need to have a temp file, if you want to use git commit -F. You can tell it to listen from stdin: https://stackoverflow.com/questions/39261961/whats-the-use-of-standard-input-mode-for-git-commit-f-in-git-bash-for-wi.

    Go ahead and create a PR for your branch and we can continue the conversation there.

  8. mateodelnorte commented on Jul 29, 2019

    @mateodelnorte
    Collaborator

    Ah, just read the last sentence. Can you pinpoint where / how the - is getting stripped?

  9. stale commented on Sep 27, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions