Skip to content

Commit fa26fa1

Browse files
jarrodmillmanddale
authored andcommitted
DOC - added gitwash directory using gitwash_dumper.py
1 parent 914a43a commit fa26fa1

20 files changed

+897
-0
lines changed

doc/devel/gitwash/branch_list.png

13 KB
Loading
10.4 KB
Loading

doc/devel/gitwash/configure_git.rst

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
.. _configure-git:
2+
3+
===============
4+
Configure git
5+
===============
6+
7+
.. _git-config-basic:
8+
9+
Overview
10+
========
11+
12+
Your personal git_ configurations are saved in the ``.gitconfig`` file in
13+
your home directory.
14+
Here is an example ``.gitconfig`` file::
15+
16+
[user]
17+
name = Your Name
18+
email = you@yourdomain.example.com
19+
20+
[alias]
21+
ci = commit -a
22+
co = checkout
23+
st = status -a
24+
stat = status -a
25+
br = branch
26+
wdiff = diff --color-words
27+
28+
[core]
29+
editor = vim
30+
31+
[merge]
32+
summary = true
33+
34+
You can edit this file directly or you can use the ``git config --global``
35+
command::
36+
37+
git config --global user.name "Your Name"
38+
git config --global user.email you@yourdomain.example.com
39+
git config --global alias.ci "commit -a"
40+
git config --global alias.co checkout
41+
git config --global alias.st "status -a"
42+
git config --global alias.stat "status -a"
43+
git config --global alias.br branch
44+
git config --global alias.wdiff "diff --color-words"
45+
git config --global core.editor vim
46+
git config --global merge.summary true
47+
48+
To set up on another computer, you can copy your ``~/.gitconfig`` file,
49+
or run the commands above.
50+
51+
In detail
52+
=========
53+
54+
user.name and user.email
55+
------------------------
56+
57+
It is good practice to tell git_ who you are, for labeling any changes
58+
you make to the code. The simplest way to do this is from the command
59+
line::
60+
61+
git config --global user.name "Your Name"
62+
git config --global user.email you@yourdomain.example.com
63+
64+
This will write the settings into your git configuration file, which
65+
should now contain a user section with your name and email::
66+
67+
[user]
68+
name = Your Name
69+
email = you@yourdomain.example.com
70+
71+
Of course you'll need to replace ``Your Name`` and ``you@yourdomain.example.com``
72+
with your actual name and email address.
73+
74+
Aliases
75+
-------
76+
77+
You might well benefit from some aliases to common commands.
78+
79+
For example, you might well want to be able to shorten ``git checkout``
80+
to ``git co``. Or you may want to alias ``git diff --color-words``
81+
(which gives a nicely formatted output of the diff) to ``git wdiff``
82+
83+
The following ``git config --global`` commands::
84+
85+
git config --global alias.ci "commit -a"
86+
git config --global alias.co checkout
87+
git config --global alias.st "status -a"
88+
git config --global alias.stat "status -a"
89+
git config --global alias.br branch
90+
git config --global alias.wdiff "diff --color-words"
91+
92+
will create an ``alias`` section in your ``.gitconfig`` file with contents
93+
like this::
94+
95+
[alias]
96+
ci = commit -a
97+
co = checkout
98+
st = status -a
99+
stat = status -a
100+
br = branch
101+
wdiff = diff --color-words
102+
103+
Editor
104+
------
105+
106+
You may also want to make sure that your editor of choice is used ::
107+
108+
git config --global core.editor vim
109+
110+
Merging
111+
-------
112+
113+
To enforce summaries when doing merges (``~/.gitconfig`` file again)::
114+
115+
[merge]
116+
log = true
117+
118+
Or from the command line::
119+
120+
git config --global merge.log true
121+
122+
123+
.. include:: links.inc
+239
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
.. _development-workflow:
2+
3+
====================
4+
Development workflow
5+
====================
6+
7+
You already have your own forked copy of the matplotlib_ repository, by
8+
following :ref:`forking`, :ref:`set-up-fork`, and you have configured
9+
git_ by following :ref:`configure-git`.
10+
11+
Workflow summary
12+
================
13+
14+
* Keep your ``master`` branch clean of edits that have not been merged
15+
to the main matplotlib_ development repo. Your ``master`` then will follow
16+
the main matplotlib_ repository.
17+
* Start a new *feature branch* for each set of edits that you do.
18+
* If you can avoid it, try not to merge other branches into your feature
19+
branch while you are working.
20+
* Ask for review!
21+
22+
This way of working really helps to keep work well organized, and in
23+
keeping history as clear as possible.
24+
25+
See |emdash| for example |emdash| `linux git workflow`_.
26+
27+
Making a new feature branch
28+
===========================
29+
30+
::
31+
32+
git branch my-new-feature
33+
git checkout my-new-feature
34+
35+
Generally, you will want to keep this also on your public github_ fork
36+
of matplotlib_. To do this, you `git push`_ this new branch up to your github_
37+
repo. Generally (if you followed the instructions in these pages, and
38+
by default), git will have a link to your github_ repo, called
39+
``origin``. You push up to your own repo on github_ with::
40+
41+
git push origin my-new-feature
42+
43+
In git >1.7 you can ensure that the link is correctly set by using the
44+
``--set-upstream`` option::
45+
46+
git push --set-upstream origin my-new-feature
47+
48+
From now on git_ will know that ``my-new-feature`` is related to the
49+
``my-new-feature`` branch in the github_ repo.
50+
51+
The editing workflow
52+
====================
53+
54+
Overview
55+
--------
56+
57+
::
58+
59+
# hack hack
60+
git add my_new_file
61+
git commit -am 'NF - some message'
62+
git push
63+
64+
In more detail
65+
--------------
66+
67+
#. Make some changes
68+
#. See which files have changed with ``git status`` (see `git status`_).
69+
You'll see a listing like this one::
70+
71+
# On branch ny-new-feature
72+
# Changed but not updated:
73+
# (use "git add <file>..." to update what will be committed)
74+
# (use "git checkout -- <file>..." to discard changes in working directory)
75+
#
76+
# modified: README
77+
#
78+
# Untracked files:
79+
# (use "git add <file>..." to include in what will be committed)
80+
#
81+
# INSTALL
82+
no changes added to commit (use "git add" and/or "git commit -a")
83+
84+
#. Check what the actual changes are with ``git diff`` (`git diff`_).
85+
#. Add any new files to version control ``git add new_file_name`` (see
86+
`git add`_).
87+
#. To commit all modified files into the local copy of your repo,, do
88+
``git commit -am 'A commit message'``. Note the ``-am`` options to
89+
``commit``. The ``m`` flag just signals that you're going to type a
90+
message on the command line. The ``a`` flag |emdash| you can just take on
91+
faith |emdash| or see `why the -a flag?`_ |emdash| and the helpful use-case
92+
description in the `tangled working copy problem`_. The `git commit`_ manual
93+
page might also be useful.
94+
#. To push the changes up to your forked repo on github_, do a ``git
95+
push`` (see `git push`).
96+
97+
Asking for code review
98+
======================
99+
100+
#. Go to your repo URL |emdash| e.g. ``http://github.com/your-user-name/matplotlib``.
101+
#. Click on the *Branch list* button:
102+
103+
.. image:: branch_list.png
104+
105+
#. Click on the *Compare* button for your feature branch |emdash| here ``my-new-feature``:
106+
107+
.. image:: branch_list_compare.png
108+
109+
#. If asked, select the *base* and *comparison* branch names you want to
110+
compare. Usually these will be ``master`` and ``my-new-feature``
111+
(where that is your feature branch name).
112+
#. At this point you should get a nice summary of the changes. Copy the
113+
URL for this, and post it to the `matplotlib mailing list`_, asking for
114+
review. The URL will look something like:
115+
``http://github.com/your-user-name/matplotlib/compare/master...my-new-feature``.
116+
There's an example at
117+
http://github.com/matthew-brett/nipy/compare/master...find-install-data
118+
See: http://github.com/blog/612-introducing-github-compare-view for
119+
more detail.
120+
121+
The generated comparison, is between your feature branch
122+
``my-new-feature``, and the place in ``master`` from which you branched
123+
``my-new-feature``. In other words, you can keep updating ``master``
124+
without interfering with the output from the comparison. More detail?
125+
Note the three dots in the URL above (``master...my-new-feature``) and
126+
see :ref:`dot2-dot3`.
127+
128+
Asking for your changes to be merged with the main repo
129+
=======================================================
130+
131+
When you are ready to ask for the merge of your code:
132+
133+
#. Go to the URL of your forked repo, say
134+
``http://github.com/your-user-name/matplotlib.git``.
135+
#. Click on the 'Pull request' button:
136+
137+
.. image:: pull_button.png
138+
139+
Enter a message; we suggest you select only ``matplotlib`` as the
140+
recipient. The message will go to the `matplotlib mailing list`_. Please
141+
feel free to add others from the list as you like.
142+
143+
Merging from trunk
144+
==================
145+
146+
This updates your code from the upstream `matplotlib github`_ repo.
147+
148+
Overview
149+
--------
150+
151+
::
152+
153+
# go to your master branch
154+
git checkout master
155+
# pull changes from github
156+
git fetch upstream
157+
# merge from upstream
158+
git merge upstream/master
159+
160+
In detail
161+
---------
162+
163+
We suggest that you do this only for your ``master`` branch, and leave
164+
your 'feature' branches unmerged, to keep their history as clean as
165+
possible. This makes code review easier::
166+
167+
git checkout master
168+
169+
Make sure you have done :ref:`linking-to-upstream`.
170+
171+
Merge the upstream code into your current development by first pulling
172+
the upstream repo to a copy on your local machine::
173+
174+
git fetch upstream
175+
176+
then merging into your current branch::
177+
178+
git merge upstream/master
179+
180+
Deleting a branch on github_
181+
============================
182+
183+
::
184+
185+
git checkout master
186+
# delete branch locally
187+
git branch -D my-unwanted-branch
188+
# delete branch on github
189+
git push origin :my-unwanted-branch
190+
191+
(Note the colon ``:`` before ``test-branch``. See also:
192+
http://github.com/guides/remove-a-remote-branch
193+
194+
Several people sharing a single repository
195+
==========================================
196+
197+
If you want to work on some stuff with other people, where you are all
198+
committing into the same repository, or even the same branch, then just
199+
share it via github_.
200+
201+
First fork matplotlib into your account, as from :ref:`forking`.
202+
203+
Then, go to your forked repository github page, say
204+
``http://github.com/your-user-name/matplotlib``
205+
206+
Click on the 'Admin' button, and add anyone else to the repo as a
207+
collaborator:
208+
209+
.. image:: pull_button.png
210+
211+
Now all those people can do::
212+
213+
git clone git@githhub.com:your-user-name/matplotlib.git
214+
215+
Remember that links starting with ``git@`` use the ssh protocol and are
216+
read-write; links starting with ``git://`` are read-only.
217+
218+
Your collaborators can then commit directly into that repo with the
219+
usual::
220+
221+
git commit -am 'ENH - much better code'
222+
git push origin master # pushes directly into your repo
223+
224+
Exploring your repository
225+
=========================
226+
227+
To see a graphical representation of the repository branches and
228+
commits::
229+
230+
gitk --all
231+
232+
To see a linear list of commits for this branch::
233+
234+
git log
235+
236+
You can also look at the `network graph visualizer`_ for your github_
237+
repo.
238+
239+
.. include:: links.inc

doc/devel/gitwash/dot2_dot3.rst

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _dot2-dot3:
2+
3+
========================================
4+
Two and three dots in difference specs
5+
========================================
6+
7+
Thanks to Yarik Halchenko for this explanation.
8+
9+
Imagine a series of commits A, B, C, D... Imagine that there are two
10+
branches, *topic* and *master*. You branched *topic* off *master* when
11+
*master* was at commit 'E'. The graph of the commits looks like this::
12+
13+
14+
A---B---C topic
15+
/
16+
D---E---F---G master
17+
18+
Then::
19+
20+
git diff master..topic
21+
22+
will output the difference from G to C (i.e. with effects of F and G),
23+
while::
24+
25+
git diff master...topic
26+
27+
would output just differences in the topic branch (i.e. only A, B, and
28+
C).

0 commit comments

Comments
 (0)