Skip to content

Commit 9a1e494

Browse files
authored
Merge pull request #10261 from Recherche-Data-Gouv/9508-update-develop-branch-to-develop-branch-pull-request
Document how to update a "develop branch to develop branch" pull request
2 parents 4de0e75 + c07f1d0 commit 9a1e494

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

doc/sphinx-guides/source/developers/version-control.rst

+40-1
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ In the issue you can simply leave a comment to say you're working on it.
9797

9898
If you tell us your GitHub username we are happy to add you to the "read only" team at https://github.com/orgs/IQSS/teams/dataverse-readonly/members so that we can assign the issue to you while you're working on it. You can also tell us if you'd like to be added to the `Dataverse Community Contributors spreadsheet <https://docs.google.com/spreadsheets/d/1o9DD-MQ0WkrYaEFTD5rF_NtyL8aUISgURsAXSL7Budk/edit?usp=sharing>`_.
9999

100+
.. _create-branch-for-pr:
101+
100102
Create a New Branch Off the develop Branch
101103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102104

103-
Always create your feature branch from the latest code in develop, pulling the latest code if necessary. As mentioned above, your branch should have a name like "3728-doc-apipolicy-fix" that starts with the issue number you are addressing (e.g. `#3728 <https://github.com/IQSS/dataverse/issues/3728>`_) and ends with a short, descriptive name. Dashes ("-") and underscores ("_") in your branch name are ok, but please try to avoid other special characters such as ampersands ("&") that have special meaning in Unix shells.
105+
Always create your feature branch from the latest code in develop, pulling the latest code if necessary. As mentioned above, your branch should have a name like "3728-doc-apipolicy-fix" that starts with the issue number you are addressing (e.g. `#3728 <https://github.com/IQSS/dataverse/issues/3728>`_) and ends with a short, descriptive name. Dashes ("-") and underscores ("_") in your branch name are ok, but please try to avoid other special characters such as ampersands ("&") that have special meaning in Unix shells. Please do not call your branch "develop" as it can cause maintainers :ref:`trouble <develop-into-develop>`.
104106

105107
Commit Your Change to Your New Branch
106108
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -299,3 +301,40 @@ GitHub documents how to make changes to a fork at https://help.github.com/articl
299301
vim path/to/file.txt
300302
git commit
301303
git push OdumInstitute 4709-postgresql_96
304+
305+
.. _develop-into-develop:
306+
307+
Handing a Pull Request from a "develop" Branch
308+
----------------------------------------------
309+
310+
Note: this is something only maintainers of Dataverse need to worry about, typically.
311+
312+
From time to time a pull request comes in from a fork of Dataverse that uses "develop" as the branch behind the PR. (We've started asking contributors not to do this. See :ref:`create-branch-for-pr`.) This is problematic because the "develop" branch is the main integration branch for the project. (See :ref:`develop-branch`.)
313+
314+
If the PR is perfect and can be merged as-is, no problem. Just merge it. However, if you would like to push commits to the PR, you are likely to run into trouble with multiple "develop" branches locally.
315+
316+
The following is a list of commands oriented toward the simple task of merging the latest from the "develop" branch into the PR but the same technique can be used to push other commits to the PR as well. In this example the PR is coming from username "coder123" on GitHub. At a high level, what we're doing is working in a safe place (/tmp) away from our normal copy of the repo. We clone the main repo from IQSS, check out coder123's version of "develop" (called "dev2" or "false develop"), merge the real "develop" into it, and push to the PR.
317+
318+
If there's a better way to do this, please get in touch!
319+
320+
.. code-block:: bash
321+
322+
# do all this in /tmp away from your normal code
323+
cd /tmp
324+
git clone [email protected]:IQSS/dataverse.git
325+
cd dataverse
326+
git remote add coder123 [email protected]:coder123/dataverse.git
327+
git fetch coder123
328+
# check out coder123's "develop" to a branch with a different name ("dev2")
329+
git checkout coder123/develop -b dev2
330+
# merge IQSS "develop" into coder123's "develop" ("dev2")
331+
git merge origin/develop
332+
# delete the IQSS "develop" branch locally (!)
333+
git branch -d develop
334+
# checkout "dev2" (false "develop") as "develop" for now
335+
git checkout -b develop
336+
# push the false "develop" to coder123's fork (to the PR)
337+
git push coder123 develop
338+
cd ..
339+
# delete the tmp space (done! \o/)
340+
rm -rf /tmp/dataverse

0 commit comments

Comments
 (0)