All Projects → torbiak → Git Autofixup

torbiak / Git Autofixup

Licence: other
create fixup commits for topic branches

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to Git Autofixup

Policy Bot
A GitHub App that enforces approval policies on pull requests
Stars: ✭ 297 (+371.43%)
Mutual labels:  code-review
Codestream
The Code Collaboration Tool Built for Remote Teams
Stars: ✭ 459 (+628.57%)
Mutual labels:  code-review
Moderncppchallengestudy
2018년 하반기에 진행하는 모던 C++ 문제 풀이 스터디 관련 자료입니다.
Stars: ✭ 29 (-53.97%)
Mutual labels:  code-review
Static Review
✋ An extendible framework for version control hooks.
Stars: ✭ 330 (+423.81%)
Mutual labels:  code-review
Gerrit Intellij Plugin
Gerrit Code Review Tool Integration for the IntelliJ Platform
Stars: ✭ 405 (+542.86%)
Mutual labels:  code-review
Audit Learning
记录自己对《代码审计》的理解和总结,对危险函数的深入分析以及在p牛的博客和代码审计圈的收获
Stars: ✭ 750 (+1090.48%)
Mutual labels:  code-review
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+7107.94%)
Mutual labels:  code-review
Code Review Emoji Guide
An emoji legend to help convey intention and added meaning in code review comments.
Stars: ✭ 52 (-17.46%)
Mutual labels:  code-review
Octotree
Browser extension that enhances GitHub code review and exploration. You can download Octotree for your browser from our website.
Stars: ✭ 21,726 (+34385.71%)
Mutual labels:  code-review
Code Review Tips
🔬 Common problems to look for in a code review
Stars: ✭ 861 (+1266.67%)
Mutual labels:  code-review
Diffr
Yet another diff highlighting tool
Stars: ✭ 338 (+436.51%)
Mutual labels:  code-review
Danger Js
⚠️ Stop saying "you forgot to …" in code review
Stars: ✭ 4,076 (+6369.84%)
Mutual labels:  code-review
Python sec
python安全和代码审计相关资料收集 resource collection of python security and code review
Stars: ✭ 921 (+1361.9%)
Mutual labels:  code-review
Cpp Project
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Stars: ✭ 328 (+420.63%)
Mutual labels:  code-review
Policial
Review pull requests for style guide violations
Stars: ✭ 36 (-42.86%)
Mutual labels:  code-review
Raptor
Web-based Source Code Vulnerability Scanner
Stars: ✭ 314 (+398.41%)
Mutual labels:  code-review
Danger
🚫 Stop saying "you forgot to …" in code review (in Ruby)
Stars: ✭ 4,691 (+7346.03%)
Mutual labels:  code-review
Code Review Bot
Code review bot and CLA verifier
Stars: ✭ 67 (+6.35%)
Mutual labels:  code-review
Bad Commit Message Blocker
Inhibits commits with bad messages from getting merged
Stars: ✭ 48 (-23.81%)
Mutual labels:  code-review
Java Concurrency
Checklist for code reviews
Stars: ✭ 842 (+1236.51%)
Mutual labels:  code-review

=pod

=head1 NAME

App::Git::Autofixup - create fixup commits for topic branches

=head1 SYNOPSIS

git-autofixup [<options>] <revision>

=head1 DESCRIPTION

F parses hunks of changes in the working directory out of C output and uses C to assign those hunks to commits in C<ErevisionE..HEAD>, which will typically represent a topic branch, and then creates fixup commits to be used with C<git rebase --interactive --autosquash>. [See C for information about git revision specification syntax.] It is assumed that hunks near changes that were previously committed to the topic branch are related.

C<@{upstream}> or C<@{u}> is likely a convenient value to use for C<ErevisionE> if the current branch has a tracking branch. See C for other ways to specify revisions.

If any changes have been staged to the index using C, then F will only consider staged hunks when trying to create fixup commits. A temporary index is used to create any resulting commits.

By default a hunk will be included in a fixup commit if all the lines in the hunk's context blamed on topic branch commits refer to the same commit, so there's no ambiguity about which commit the hunk corresponds to. If there is ambiguity the assignment behaviour used under C<--strict 1> will be used to attempt to resolve it. If C<--strict 1> is given the same topic branch commit must be blamed for every removed line and at least one of the lines adjacent to each added line, and added lines must not be adjacent to lines blamed on other topic branch commits. All the same restrictions apply when C<--strict 2> is given, but each added line must be surrounded by lines blamed on the same topic branch commit.

For example, the added line in the hunk below is adjacent to lines committed by commits C<99f370af> and C. If these are both topic branch commits then it's ambiguous which commit the added line is fixing up and the hunk will be ignored.

COMMIT  |LINE|HEAD                          |WORKING DIRECTORY
99f370af|   1|first line                    | first line
        |    |                              |+added line
a1eadbe2|   2|second line                   | second line

But if that second line were instead blamed on an upstream commit (denoted by C<^>), the hunk would be added to a fixup commit for C<99f370af>:

99f370af|   1|first line                    | first line
        |    |                              |+added line
^       |   2|second line                   | second line

Output similar to this example can be generated by setting verbosity to 2 or greater by using the verbosity option multiple times, eg. C<git-autofixup -vv>, and can be helpful in determining how a hunk will be handled.

F is not to be used mindlessly. Always inspect the created fixup commits to ensure hunks have been assigned correctly, especially when used on a working directory that has been changed with a mix of fixups and new work.

=head1 OPTIONS

=over

=item -h

Show usage.

=item --help

Show manpage.

=item --version

Show version.

=item -v, --verbose

Increase verbosity. Can be used up to two times.

=item -c N, --context N

Change the number of context lines C uses around hunks. Default: 3. This can change how hunks are assigned to fixup commits, especially with C<--strict 0>.

=item -s N, --strict N

Set how strict F is about assigning hunks to fixup commits. Default: 0. Strictness levels are described under DESCRIPTION.

=item -g ARG, --gitopt ARG

Specify option for git. Can be used multiple times. Useful for testing, to override config options that break git-autofixup, or to override global diff options to tweak what git-autofixup considers a hunk.

Note ARG won't be wordsplit, so to give multiple arguments, such as for setting a config option like C<-c diff.algorithm>, this option must be used multiple times: C<-g -c -g diff.algorithm=patience>.

=item -e, --exit-code

Use more detailed exit codes:

=over

=item 0:

All hunks have been assigned.

=item 1:

Only some hunks have been assigned.

=item 2:

No hunks have been assigned.

=item 3:

There was nothing to be assigned.

=item 255:

Unexpected error occurred.

=back

=back

=head1 INSTALLATION

If cpan is available, run C<cpan -i App::Git::Autofixup>. Otherwise, copy F to a directory in C and ensure it has execute permissions. It can then be invoked as either C or C, since git searches C for appropriately named binaries.

Git is distributed with Perl 5 for platforms not expected to already have it installed, but installing modules with cpan requires other tools that might not be available, such as make. This script has no dependencies outside of the standard library, so it is hoped that it works on any platform that Git does without much trouble.

Requires a git supporting C<commit --fixup>: 1.7.4 or later.

=head1 BUGS/LIMITATIONS

If a topic branch adds some lines in one commit and subsequently removes some of them in another, a hunk in the working directory that re-adds those lines will be assigned to fixup the first commit, and during rebasing they'll be removed again by the later commit.

Not tested in F<cmd.exe> on Windows. Run it from Git Bash, Cygwin, or a similar Unix emulation environment.

=head1 ACKNOWLEDGEMENTS

F was inspired by a description of L<hg absorb|https://bitbucket.org/facebook/hg-experimental/src/38d6e5d7f355f58330cd707059baac38d69a1210/hgext3rd/absorb/__init__.py> in the L<Mercurial Sprint Notes|https://groups.google.com/forum/#!topic/mozilla.dev.version-control/nh4fITFlEMk>. While I was working on it I found L<git-superfixup|https://gist.github.com/oktal3700/cafe086b49c89f814be4a7507a32a3f7>, by oktal3700, which was helpful to examine.

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2017, Jordan Torbiak.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0.

=cut

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].