Skip to content

Commit

Permalink
Merge pull request #2371 from Michael-E-Rose/gitwash-update
Browse files Browse the repository at this point in the history
Gitwash update
  • Loading branch information
hagberg committed Apr 2, 2017
2 parents 0691a24 + b1b6936 commit abf040a
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 186 deletions.
24 changes: 13 additions & 11 deletions doc/source/developer/gitwash/development_workflow.rst
Expand Up @@ -5,7 +5,7 @@ Development workflow
####################

You already have your own forked copy of the `networkx`_ repository, by
following :ref:`forking`. You have :ref:`set-up-fork`. You have configured
following :ref:`forking`. You have :ref:`set-up-fork`. You have configured
git by following :ref:`configure-git`. Now you are ready for some real work.

Workflow summary
Expand All @@ -25,6 +25,8 @@ In what follows we'll refer to the upstream networkx ``master`` branch, as
your feature branch while you are working.
* If you do find yourself merging from trunk, consider :ref:`rebase-on-trunk`
* Ask on the `networkx mailing list`_ if you get stuck.
* Check that your code meets the requirements as outlined in our
(wiki)[https://github.com/networkx/networkx/wiki].
* Ask for code review!

This way of working helps to keep work well organized, with readable history.
Expand Down Expand Up @@ -136,10 +138,10 @@ In more detail
`git add`_).
#. To commit all modified files into the local copy of your repo,, do
``git commit -am 'A commit message'``. Note the ``-am`` options to
``commit``. The ``m`` flag just signals that you're going to type a
``commit``. The ``m`` flag just signals that you're going to type a
message on the command line. The ``a`` flag |emdash| you can just take on
faith |emdash| or see `why the -a flag?`_ |emdash| and the helpful use-case
description in the `tangled working copy problem`_. The `git commit`_ manual
description in the `tangled working copy problem`_. The `git commit`_ manual
page might also be useful.
#. To push the changes up to your forked repo on github, do a ``git
push`` (see `git push`_).
Expand Down Expand Up @@ -240,7 +242,7 @@ Rebasing on trunk

Let's say you thought of some work you'd like to do. You
:ref:`update-mirror-trunk` and :ref:`make-feature-branch` called
``cool-feature``. At this stage trunk is at some commit, let's call it E. Now
``cool-feature``. At this stage trunk is at some commit, let's call it E. Now
you make some new commits on your ``cool-feature`` branch, let's call them A, B,
C. Maybe your changes take a while, or you come back to them after a while. In
the meantime, trunk has progressed from commit E to commit (say) G::
Expand All @@ -251,14 +253,14 @@ the meantime, trunk has progressed from commit E to commit (say) G::

At this stage you consider merging trunk into your feature branch, and you
remember that this here page sternly advises you not to do that, because the
history will get messy. Most of the time you can just ask for a review, and not
history will get messy. Most of the time you can just ask for a review, and not
worry that trunk has got a little ahead. But sometimes, the changes in trunk
might affect your changes, and you need to harmonize them. In this situation
you may prefer to do a rebase.

rebase takes your changes (A, B, C) and replays them as if they had been made to
the current state of ``trunk``. In other words, in this case, it takes the
changes represented by A, B, C and replays them on top of G. After the rebase,
changes represented by A, B, C and replays them on top of G. After the rebase,
your history will look like this::

A'--B'--C' cool-feature
Expand Down Expand Up @@ -292,15 +294,15 @@ If it doesn't look good you may need to have a look at

If you have made changes to files that have also changed in trunk, this may
generate merge conflicts that you need to resolve - see the `git rebase`_ man
page for some instructions at the end of the "Description" section. There is
page for some instructions at the end of the "Description" section. There is
some related help on merging in the git user manual - see `resolving a merge`_.

.. _recovering-from-mess-up:

Recovering from mess-ups
------------------------

Sometimes, you mess up merges or rebases. Luckily, in git it is
Sometimes, you mess up merges or rebases. Luckily, in git it is
relatively straightforward to recover from such mistakes.

If you mess up during a rebase::
Expand Down Expand Up @@ -350,7 +352,7 @@ Suppose that the commit history looks like this::
29001ed Add pre-nep for a copule of structured_array_extensions.
...

and ``6ad92e5`` is the last commit in the ``cool-feature`` branch. Suppose we
and ``6ad92e5`` is the last commit in the ``cool-feature`` branch. Suppose we
want to make the following changes:

* Rewrite the commit message for ``13d7934`` to something more sensible.
Expand Down Expand Up @@ -391,11 +393,11 @@ To achieve what we want, we will make the following changes to it::
f eadc391 Fix some remaining bugs

This means that (i) we want to edit the commit message for
``13d7934``, and (ii) collapse the last three commits into one. Now we
``13d7934``, and (ii) collapse the last three commits into one. Now we
save and quit the editor.

Git will then immediately bring up an editor for editing the commit
message. After revising it, we get the output::
message. After revising it, we get the output::

[detached HEAD 721fc64] FOO: First implementation
2 files changed, 199 insertions(+), 66 deletions(-)
Expand Down
24 changes: 14 additions & 10 deletions doc/source/developer/gitwash/following_latest.rst
Expand Up @@ -25,8 +25,8 @@ You now have a copy of the code tree in the new ``networkx`` directory.
Updating the code
=================

From time to time you may want to pull down the latest code. It is necessary
to add the networkx repository as a remote to your configuration file. We call it
From time to time you may want to pull down the latest code. It is necessary
to add the networkx repository as a remote to your configuration file. We call it
upstream.

git remote set-url upstream https://github.com/networkx/networkx.git
Expand All @@ -37,22 +37,26 @@ Now git knows where to fetch updates from.
git fetch upstream

The tree in ``networkx`` will now have the latest changes from the initial
repository, unless you have made local changes in the meantime. In this case, you have to merge.
repository, unless you have made local changes in the meantime. In this
case, you have to merge.

git merge upstream/master

It is also possible to update your local fork directly from GitHub:

1. Open your fork on GitHub.
2. Click on 'Pull Requests'.
3. Click on 'New Pull Request'. By default, GitHub will compare the original with your fork. If you didn’t make any changes, there is nothing to compare.
4. Click on 'Switching the base' or click 'Edit' and switch the base manually. Now GitHub will compare your fork with the original, and you should see all the latest changes.
5. Click on 'Click to create a pull request for this comparison' and name your pull request.
3. Click on 'New Pull Request'. By default, GitHub will compare the
original with your fork. If you didn’t make any changes, there is
nothing to compare.
4. Click on 'Switching the base' or click 'Edit' and switch the
base manually. Now GitHub will compare your fork with the original,
and you should see all the latest changes.
5. Click on 'Click to create a pull request for this comparison' and name
your pull request.
6. Click on Send pull request.
7. Scroll down and click 'Merge pull request' and finally 'Confirm merge'. You will be able to merge it automatically unless you did not change you local repo.

7. Scroll down and click 'Merge pull request' and finally 'Confirm merge'.
You will be able to merge it automatically unless you did not change you local repo.


.. include:: links.inc


2 changes: 1 addition & 1 deletion doc/source/developer/gitwash/git_intro.rst
Expand Up @@ -9,7 +9,7 @@ There are several different workflows here, for different ways of
working with *networkx*.

This is not a comprehensive git reference, it's just a workflow for our
own project. It's tailored to the github hosting service. You may well
own project. It's tailored to the github hosting service. You may well
find better or quicker ways of getting stuff done with git, but these
should get you started.

Expand Down
49 changes: 25 additions & 24 deletions doc/source/developer/gitwash/git_links.inc
@@ -1,42 +1,43 @@
.. This (-*- rst -*-) format file contains commonly used link targets
and name substitutions. It may be included in many files,
and name substitutions. It may be included in many files,
therefore it should only contain link targets and name
substitutions. Try grepping for "^\.\. _" to find plausible
substitutions. Try grepping for "^\.\. _" to find plausible
candidates for this list.
.. NOTE: reST targets are
__not_case_sensitive__, so only one target definition is needed for
nipy, NIPY, Nipy, etc...
.. git stuff
.. git internals
.. _git: http://git-scm.com/
.. _github: http://github.com
.. _github help: http://help.github.com
.. _github more help: https://help.github.com/articles/what-are-other-good-resources-for-learning-git-and-github/
.. _github help: https://git-scm.com/docs/git
.. _github more help: https://help.github.com/articles/git-and-github-learning-resources/
.. _git svn crash course: http://git-scm.com/course/svn.html
.. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer
.. _git tutorial: https://git-scm.com/docs/gittutorial
.. _git clone: https://git-scm.com/docs/git-clone
.. _git checkout: https://git-scm.com/docs/git-checkout
.. _git commit: https://git-scm.com/docs/git-commit
.. _git push: https://git-scm.com/docs/git-push
.. _git pull: https://git-scm.com/docs/git-pull
.. _git add: https://git-scm.com/docs/git-add
.. _git status: https://git-scm.com/docs/git-status
.. _git diff: https://git-scm.com/docs/git-diff
.. _git log: https://git-scm.com/docs/git-log
.. _git branch: https://git-scm.com/docs/git-branch
.. _git remote: https://git-scm.com/docs/git-remote
.. _git rebase: https://git-scm.com/docs/git-rebase
.. _git config: https://git-scm.com/docs/git-config

.. git guides
.. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/
.. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
.. _msysgit: http://code.google.com/p/msysgit/downloads/list
.. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list
.. _subversion: http://subversion.tigris.org/
.. _git svn crash course: http://git-scm.com/course/svn.html
.. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer
.. _git user manual: http://schacon.github.com/git/user-manual.html
.. _git tutorial: http://schacon.github.com/git/gittutorial.html
.. _Nick Quaranto: http://www.gitready.com/
.. _Fernando Perez: http://www.fperez.org/py4science/git.html
.. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
.. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/
.. _git clone: http://schacon.github.com/git/git-clone.html
.. _git checkout: http://schacon.github.com/git/git-checkout.html
.. _git commit: http://schacon.github.com/git/git-commit.html
.. _git push: http://schacon.github.com/git/git-push.html
.. _git pull: http://schacon.github.com/git/git-pull.html
.. _git add: http://schacon.github.com/git/git-add.html
.. _git status: http://schacon.github.com/git/git-status.html
.. _git diff: http://schacon.github.com/git/git-diff.html
.. _git log: http://schacon.github.com/git/git-log.html
.. _git branch: http://schacon.github.com/git/git-branch.html
.. _git remote: http://schacon.github.com/git/git-remote.html
.. _git rebase: http://schacon.github.com/git/git-rebase.html
.. _git config: http://schacon.github.com/git/git-config.html
.. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html
.. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html
.. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git
Expand Down
6 changes: 3 additions & 3 deletions doc/source/developer/gitwash/git_resources.rst
Expand Up @@ -7,12 +7,12 @@ git resources
Tutorials and summaries
=======================

`github help`_ is Git's own help and tutorial site. `github more help`_ lists more resources for learning Git and GitHub, including YouTube
channels. The list is constantly updated. In case you are used to subversion_
`github help`_ is Git's own help and tutorial site. `github more help`_
lists more resources for learning Git and GitHub, including YouTube
channels. The list is constantly updated. In case you are used to subversion_
, you can directly consult the `git svn crash course`_.

To make full use of Git, you need to understand the concept behind Git.

The following pages might help you:

* `git parable`_ |emdash| an easy read parable
Expand Down
3 changes: 0 additions & 3 deletions doc/source/developer/gitwash/index.rst
Expand Up @@ -11,8 +11,5 @@ Contents:
git_intro
git_install
following_latest
patching
git_development
git_resources


134 changes: 0 additions & 134 deletions doc/source/developer/gitwash/patching.rst

This file was deleted.

0 comments on commit abf040a

Please sign in to comment.