1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
'\" t
.\" Title: git-absorb
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 04/06/2023
.\" Manual: git absorb
.\" Source: git-absorb 0.5.0
.\" Language: English
.\"
.TH "GIT\-ABSORB" "1" "04/06/2023" "git\-absorb 0\&.5\&.0" "git absorb"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-absorb \- Automatically absorb staged changes into your current branch
.SH "SYNOPSIS"
.sp
.nf
\fIgit absorb\fR [FLAGS] [OPTIONS]
.fi
.SH "DESCRIPTION"
.sp
You have a feature branch with a few commits\&. Your teammate reviewed the branch and pointed out a few bugs\&. You have fixes for the bugs, but you don\(cqt want to shove them all into an opaque commit that says fixes, because you believe in atomic commits\&. Instead of manually finding commit SHAs for git commit \-\-fixup, or running a manual interactive rebase, do this:
.sp
.if n \{\
.RS 4
.\}
.nf
$ git add $FILES_YOU_FIXED
$ git absorb \-\-and\-rebase
(or)
$ git absorb
$ git rebase \-i \-\-autosquash master
.fi
.if n \{\
.RE
.\}
.sp
git absorb will automatically identify which commits are safe to modify, and which indexed changes belong to each of those commits\&. It will then write fixup! commits for each of those changes\&. You can check its output manually if you don\(cqt trust it, and then fold the fixups into your feature branch with git\(cqs built\-in autosquash functionality\&.
.SH "FLAGS"
.PP
\-r, \-\-and\-rebase
.RS 4
Run rebase if successful
.RE
.PP
\-n, \-\-dry\-run
.RS 4
Don\(cqt make any actual changes
.RE
.PP
\-f, \-\-force
.RS 4
Skip safety checks
.RE
.PP
\-w, \-\-whole\-file
.RS 4
Match the first commit touching the same file as the current hunk\&. Use this with care!
.RE
.PP
\-h, \-\-help
.RS 4
Prints help information
.RE
.PP
\-V, \-\-version
.RS 4
Prints version information
.RE
.PP
\-v, \-\-verbose
.RS 4
Display more output
.RE
.SH "OPTIONS"
.PP
\-b <base>, \-\-base <base>
.RS 4
Use this commit as the base of the absorb stack
.RE
.SH "USAGE"
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
git add
any changes that you want to absorb\&. By design,
git absorb
will only consider content in the git index\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
git absorb\&. This will create a sequence of commits on
HEAD\&. Each commit will have a
fixup!
message indicating the message (if unique) or SHA of the commit it should be squashed into\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 3." 4.2
.\}
If you are satisfied with the output,
git rebase \-i \-\-autosquash
to squash the
fixup!
commits into their predecessors\&. You can set the [GIT_SEQUENCE_EDITOR][] environment variable if you don\(cqt need to edit the rebase TODO file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 4." 4.2
.\}
If you are not satisfied (or if something bad happened),
git reset \-\-soft
to the pre\-absorption commit to recover your old state\&. (You can find the commit in question with
git reflog\&.) And if you think
git absorb
is at fault, please [file an issue][]\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
[GIT_SEQUENCE_EDITOR]: https://stackoverflow\&.com/a/29094904
[file an issue]: https://github\&.com/tummychow/git\-absorb/issues/new
.fi
.if n \{\
.RE
.\}
.SH "CONFIGURATION"
.SS "STACK SIZE"
.sp
When run without \-\-base, git\-absorb will only search for candidate commits to fixup within a certain range (by default 10)\&. If you get an error like this:
.sp
.if n \{\
.RS 4
.\}
.nf
WARN stack limit reached, limit: 10
.fi
.if n \{\
.RE
.\}
.sp
edit your local or global \&.gitconfig and add the following section:
.sp
.if n \{\
.RS 4
.\}
.nf
[absorb]
maxStack=50 # Or any other reasonable value for your project
.fi
.if n \{\
.RE
.\}
.SH "GITHUB PROJECT"
.sp
https://github\&.com/tummychow/git\-absorb
.SH "AUTHOR"
.sp
Stephen Jung <tummychow511@gmail\&.com>
|