File: man.rst

package info (click to toggle)
git-revise 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: python: 2,505; makefile: 16
file content (284 lines) | stat: -rw-r--r-- 8,639 bytes parent folder | download
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
.. _git_revise:

=========================================================================
``git-revise(1)`` -- Efficiently update, split, and rearrange git commits
=========================================================================

.. program:: git revise:

SYNOPSIS
========

*git revise* [<options>] [<target>]

DESCRIPTION
===========

:program:`git revise` is a :manpage:`git(1)` subcommand to efficiently
update, split, and rearrange commits. It is heavily inspired by
:manpage:`git-rebase(1)`, however tries to be more efficient and ergonomic for
patch-stack oriented workflows.

By default, :program:`git revise` will apply staged changes to <target>,
updating ``HEAD`` to point at the revised history. It also supports splitting
commits, rewording commit messages.

Unlike :manpage:`git-rebase(1)`, :program:`git revise` avoids modifying
working directory and index state, performing all merges in-memory, and only
writing them when necessary. This allows it to be significantly faster on
large codebases, and avoid invalidating builds.

If :option:`--autosquash` or :option:`--interactive` is specified, the
<target> argument may be omitted or given as the special value `:option:--root`.
If it is omitted, :program:`git revise` will consider a range of unpublished
commits on the current branch. If given as `:option:--root`, all commits
including the root commit will be considered.

OPTIONS
=======

General options
---------------

.. option:: -a, --all

   Stage changes to tracked files before revising.

.. option:: -p, --patch

   Interactively stage hunks from the worktree before revising.

.. option:: --no-index

   Ignore staged changes in the index.

.. option:: --reauthor

   Reset target commit's author to the current user.

.. option:: --ref <gitref>

   Working branch to update; defaults to ``HEAD``.

.. option:: -S, --gpg-sign, --no-gpg-sign

   GPG-sign commits.  Overrides both the ``commit.gpgSign`` and
   ``revise.gpgSign`` git configurations.

Main modes of operation
-----------------------

.. option:: -i, --interactive

   Rather than applying staged changes to <target>, edit a todo list of
   actions to perform on commits after <target>. See :ref:`interactive-mode`.

.. option:: --autosquash, --no-autosquash

   Rather than directly applying staged changes to <target>, automatically
   perform fixup or squash actions marked with ``fixup!`` or ``squash!``
   between <target> and the current ``HEAD``. For more information on what
   these actions do, see :ref:`interactive-mode`.

   These commits are usually created with ``git commit --fixup=<commit>`` or
   ``git commit --squash=<commit>``, and identify the target with the first
   line of its commit message.

   This option can be combined with :option:`--interactive` to modify the
   generated todos before they're executed.

   If the :option:`--autosquash` option is enabled by default using a
   configuration variable, the option :option:`--no-autosquash` can be used
   to override and disable this setting. See :ref:`configuration`.

.. option:: -c, --cut

   Interactively select hunks from <target>. The chosen hunks are split into
   a second commit immediately after the target.

   After splitting is complete, both commits' messages are edited.

   See the "Interactive Mode" section of :manpage:`git-add(1)` to learn how
   to operate this mode.

.. option:: -e, --edit

   After applying staged changes, edit <target>'s commit message.

   This option can be combined with :option:`--interactive` to allow editing
   of commit messages within the todo list. For more information on, see
   :ref:`interactive-mode`.

.. option:: -m <msg>, --message <msg>

   Use the given <msg> as the new commit message for <target>. If multiple
   :option:`-m` options are given, their values are concatenated as separate
   paragraphs.

.. option:: --version

   Print version information and exit.


.. _configuration:

CONFIGURATION
=============

Configuration is managed by :manpage:`git-config(1)`.

.. gitconfig:: revise.autoSquash

   If set to true, imply :option:`--autosquash` whenever :option:`--interactive`
   is specified. Overridden by :option:`--no-autosquash`. Defaults to false. If
   not set, the value of ``rebase.autoSquash`` is used instead.

.. gitconfig:: revise.gpgSign

   If set to true, GPG-sign new commits; defaults to false.  This setting
   overrides the original git configuration ``commit.gpgSign`` and may be
   overridden by the command line options ``--gpg-sign`` and
   ``--no-gpg-sign``.


CONFLICT RESOLUTION
===================

When a conflict is encountered, :command:`git revise` will attempt to resolve
it automatically using standard git mechanisms. If automatic resolution
fails, the user will be prompted to resolve them manually.

There is currently no support for using :manpage:`git-mergetool(1)` to
resolve conflicts.

No attempt is made to detect renames of files or directories. :command:`git
revise` may produce suboptimal results across renames. Use the interactive
mode of :manpage:`git-rebase(1)` when rename tracking is important.


NOTES
=====

A successful :command:`git revise` will add a single entry to the reflog,
allowing it to be undone with ``git reset @{1}``. Unsuccessful :command:`git
revise` commands will leave your repository largely unmodified.

No merge commits may occur between the target commit and ``HEAD``, as
rewriting them is not supported.

See :manpage:`git-rebase(1)` for more information on the implications of
modifying history on a repository that you share.


.. _interactive-mode:

INTERACTIVE MODE
================

:command:`git revise` supports an interactive mode inspired by the
interactive mode of :manpage:`git-rebase(1)`.

This mode is started with the last commit you want to retain "as-is":

.. code-block:: bash

    git revise -i <after-this-commit>

The special target `--root` is available to revise everything up to the root
commit:

.. code-block:: bash

    git revise -i --root

An editor will be fired up with the commits in your current branch after the
given commit. If the index has any staged but uncommitted changes, a ``<git
index>`` entry will also be present.

.. code-block:: none

    pick 8338dfa88912 Oneline summary of first commit
    pick 735609912343 Summary of second commit
    index 672841329981 <git index>

These commits may be re-ordered to change the order they appear in history.
In addition, the ``pick`` and ``index`` commands may be replaced to modify
their behaviour. If present, ``index`` commands must be at the bottom of the
list, i.e. they can not be followed by non-index commands.

If :option:`-e` was specified, the full commit message will be included, and
each command line will begin with a ``++``. Any changes made to the commit
messages in this file will be applied to the commit in question, allowing for
simultaneous editing of commit messages during the todo editing phase.

.. code-block:: none

    ++ pick 8338dfa88912
    Oneline summary of first commit

    Body of first commit

    ++ pick 735609912343
    Summary of second commit

    Body of second commit

    ++ index 672841329981
    <git index>

The following commands are supported in all interactive modes:

.. describe:: index

   Do not commit these changes, instead leaving them staged in the index.
   Index lines must come last in the file.

   .. note:
      Commits may not be deleted or dropped from the to-do list. To remove a
      commit, mark it as an index action, and use :manpage:`git-reset(1)` to
      discard staged changes.

.. describe:: pick

   Use the given commit as-is in history. When applied to the generated
   ``index`` entry, the commit will have the message ``<git index>``.

.. describe:: squash

   Add the commit's changes into the previous commit and open an editor
   to merge the commits' messages.

.. describe:: fixup

   Like squash, but discard this commit's message rather than editing.

.. describe:: reword

   Open an editor to modify the commit message.

.. describe:: cut

   Interactively select hunks from the commit. The chosen hunks are split
   into a second commit immediately after it.

   After splitting is complete, both commits' messages are edited.

   See the "Interactive Mode" section of :manpage:`git-add(1)` to learn how
   to operate this mode.


REPORTING BUGS
==============

Please report issues and feature requests to the issue tracker at
https://github.com/mystor/git-revise/issues.

Code, documentation and other contributions are also welcomed.


SEE ALSO
========

:manpage:`git(1)`
:manpage:`git-rebase(1)`
:manpage:`git-add(1)`