Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 863cf89

Browse files
committed
clarify pre-commits and editing workflow
1 parent 704f0a0 commit 863cf89

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

doc/devel/development_setup.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,27 @@ true for ``*.py`` files. If you change the C-extension source (which might
164164
also happen if you change branches) you will have to re-run
165165
``python -m pip install -ve .``
166166

167-
Install pre-commit hooks (optional)
168-
===================================
169-
`pre-commit <https://pre-commit.com/>`_ hooks automatically check flake8 and
170-
other style issues when you run ``git commit``. The hooks are defined in the
171-
top level ``.pre-commit-config.yaml`` file. To install the hooks ::
167+
Install pre-commit hooks
168+
========================
169+
`pre-commit <https://pre-commit.com/>`_ hooks save time in the review process by
170+
identifying issues with the code before a pull request is formally opened. Most
171+
hooks can also aide in fixing the errors, and the checks should have
172+
corresponding :ref:`development workflow <development-workflow>` and
173+
:ref:`pull request <pr-guidelines>` guidelines. Hooks are configured in
174+
`.pre-commit-config.yaml <https://github.com/matplotlib/matplotlib/blob/main/.pre-commit-config.yaml?>`_
175+
and include checks for spelling and formatting, flake 8 conformity, accidentally
176+
committed files, import order, and incorrect branching.
177+
178+
Install pre-commit hooks ::
172179

173180
python -m pip install pre-commit
174181
pre-commit install
175182

176-
The hooks can also be run manually. All the hooks can be run, in order as
183+
Hooks are run automatically after the ``git commit`` stage of the
184+
:ref:`editing workflow<edit-flow>`. When a hook has found and fixed an error in a
185+
file, that file must be *staged and committed* again.
186+
187+
Hooks can also be run manually. All the hooks can be run, in order as
177188
listed in ``.pre-commit-config.yaml``, against the full codebase with ::
178189

179190
pre-commit run --all-files

doc/devel/development_workflow.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,8 @@ request and open a new pull request from the renamed branch. See
9595
The editing workflow
9696
====================
9797

98-
Overview
99-
--------
100-
101-
::
102-
103-
# hack hack
104-
git add my_new_file
105-
git commit -am 'NF - some message'
106-
git push
107-
108-
In more detail
109-
--------------
110-
11198
#. Make some changes
99+
#. Save the changes
112100
#. See which files have changed with ``git status``.
113101
You'll see a listing like this one:
114102

@@ -129,13 +117,17 @@ In more detail
129117
130118
#. Check what the actual changes are with ``git diff``.
131119
#. Add any new files to version control ``git add new_file_name``.
132-
#. To commit all modified files into the local copy of your repo,, do
133-
``git commit -am 'A commit message'``. Note the ``-am`` options to
134-
``commit``. The ``m`` flag just signals that you're going to type a
135-
message on the command line. The ``a`` flag — you can just take on
136-
faith — or see `why the -a flag?`_. The
137-
`git commit <https://git-scm.com/docs/git-commit>`_ manual page might also be
138-
useful.
120+
#. To commit **all** modified files into the local copy of your repo, type:
121+
122+
.. code-block:: bash
123+
124+
git commit -am 'A commit message'
125+
126+
Note the ``-am`` options to ``commit``. The ``m`` flag signals that you are
127+
going to type a message on the command line. The ``a`` flag stages every
128+
file that has been modified, except files listed in ``.gitignore``. For more
129+
information, see `why the -a flag?`_ and the
130+
`git commit <https://git-scm.com/docs/git-commit>`_ manual page.
139131
#. To push the changes up to your forked repo on GitHub, do a ``git
140132
push``.
141133

0 commit comments

Comments
 (0)