App-GitUtils
view release on metacpan or search on metacpan
"stream" : 0,
"title" : "gu status"
}
]
=head2 Running hooks
% gu run-hook post-commit
% gu rh pre-commit
Some shortcuts:
% gu post-commit; # shortcut for 'gu rh post-commit'
% gu pre-commit; # shortcut for 'gu rh pre-commit'
=head2 Cloning
% gu clone-to-bare
Deprecated. Basically just C<git clone --bare>.
=head2 Subcommand: ls-committing-large
This subcommand lists large files that are being committed.
% gu ls-committing-large
Merriweather,Roboto.zip
% gu ls-committing-large -l
+-------------------------+-----------+-----------+
| file | section | size |
+-------------------------+-----------+-----------+
| Merriweather,Roboto.zip | untracked | 167760256 |
+-------------------------+-----------+-----------+
% gu ls-committing-large --exclude-untracked
You can do something like this in a `pre-commit` Bash script hook, for example:
# GitHub rejects files over 100MB
if [[ `gu ls-committing-large 100MB` != "" ]]; then
echo "Cancelling commit, there are files that will be rejected by GitHub"
exit 1
fi
=head2 Subcommand: du-committing
Calculate the size of the commit.
% gu du-committing
271205519
% gu du-committing | datasize-to-metric
258.6MB
(Note: L<datasize-to-metric> is from L<App::DataSizeSpeedUtils>).
You can do something like this in a `pre-commit` Bash script hook, for example:
# GitHub rejects commit size over 2GB
if [[ `gu du-committing` > $[2*1024*1024*1024] ]]; then
echo "Cancelling commit, too large, will be rejected by GitHub"
exit 1
fi
=head2 Subcommand: split-commit-add-untracked
If you have untracked files with a total size of larger than 2GB, you can split
the commit using this subcommand:
% gu split-commit-add-untracked
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-GitUtils>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-App-GitUtils>.
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
that are considered a bug and can be reported to me.
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-GitUtils>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=cut
( run in 2.150 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )