Updated contribution documentation with how to sync upstream repo
This commit is contained in:
parent
b661407952
commit
bdff6eb5c9
@ -25,7 +25,7 @@ Filing an issue on Gitlab
|
||||
--------------------------
|
||||
|
||||
The `gitlab issue tracker <https://gitlab.com/slumber/multi-user/issues>`_ is used for bug report and enhancement suggestion.
|
||||
You will need a Gitlab account to be able to open a new issue there and click on "New issue" button.
|
||||
You will need a Gitlab account to be able to open a new issue there and click on "New issue" button in the main multi-user project.
|
||||
|
||||
Here are some useful information you should provide in a bug report:
|
||||
|
||||
@ -35,7 +35,7 @@ Here are some useful information you should provide in a bug report:
|
||||
Contributing code
|
||||
=================
|
||||
|
||||
In general, this project follows the `Gitflow Workflow <https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow>`_.
|
||||
In general, this project follows the `Gitflow Workflow <https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow>`_. It may help to understand that there are three different repositories - the upstream (main multi-user project repository, designated in git by 'upstream'), remote (forked repository, designated in git by 'origin'), and the local repository on your machine.
|
||||
The following example suggests how to contribute a feature.
|
||||
|
||||
1. Fork the project into a new repository:
|
||||
@ -46,26 +46,57 @@ The following example suggests how to contribute a feature.
|
||||
|
||||
git clone https://gitlab.com/yourname/multi-user.git
|
||||
|
||||
3. Create your own feature branch from the develop branch, using the syntax:
|
||||
3. Keep your fork in sync with the main repository by setting up the upstream pointer once. cd into your git repo and then run:
|
||||
.. code-block:: bash
|
||||
|
||||
git remote add upstream https://gitlab.com/slumber/multi-user.git
|
||||
|
||||
4. Now, locally check out the develop branch, upon which to base your new feature branch:
|
||||
.. code-block:: bash
|
||||
|
||||
git checkout develop
|
||||
|
||||
5. Fetch any changes from the main upstream repository into your fork (especially if some time has passed since forking):
|
||||
.. code-block:: bash
|
||||
|
||||
git fetch upstream
|
||||
|
||||
'Fetch' downloads objects and refs from the repository, but doesn’t apply them to the branch we are working on. We want to apply the updates to the branch we will work from, which we checked out in step 4.
|
||||
|
||||
6. Let's merge any recent changes from the remote upstream (original repository's) 'develop' branch into our local 'develop' branch:
|
||||
.. code-block:: bash
|
||||
|
||||
git merge upstream/develop
|
||||
|
||||
7. Update your forked repository's remote 'develop' branch with the fetched changes, just to keep things tidy. Make sure you haven't committed any local changes in the interim:
|
||||
.. code-block:: bash
|
||||
|
||||
git push origin develop
|
||||
|
||||
8. Locally create your own new feature branch from the develop branch, using the syntax:
|
||||
.. code-block:: bash
|
||||
|
||||
git checkout -b feature/yourfeaturename
|
||||
...where 'feature/' designates a feature branch, and 'yourfeaturename' is a name of your choosing
|
||||
|
||||
4. Pull any recent changes from the 'develop' branch:
|
||||
.. code-block:: bash
|
||||
|
||||
git pull
|
||||
5. Add and commit your changes, including a commit message:
|
||||
9. Add and commit your changes, including a commit message:
|
||||
.. code-block:: bash
|
||||
|
||||
git commit -am 'Add fooBar'
|
||||
6. Push committed changes to the remote feature branch you created
|
||||
|
||||
10. Push committed changes to the remote copy of your new feature branch which will be created in this step:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git push -u origin feature/yourfeaturename
|
||||
|
||||
git push origin feature/yourfeaturename
|
||||
7. Create a new Pull Request on Gitlab
|
||||
merging the changes into the develop branch
|
||||
.. Hint:: -u option sets up your locally created new branch to follow a remote branch which is now created with the same name on your remote repository.
|
||||
.. Note:: If it's been some time since performing steps 4 through 7, make sure to checkout 'develop' again and pull the latest changes from upstream before checking out and creating feature/yourfeaturename and pushing changes
|
||||
|
||||
.. Note:: For hotfixes, replace 'feature/' with 'hotfix/' and fork from 'master' branch instead of 'develop' branch
|
||||
.. Note:: Let's follow the Atlassian `Gitflow Workflow <https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow>`_, except for one main difference - submitting a pull request rather than merging by ourselves.
|
||||
11. Finally, create a new Pull/Merge Request on Gitlab to merge the remote version of this new branch with commited updates, back into the upstream develop branch, finalising the integration of the new feature.
|
||||
|
||||
12. Thanks for contributing!
|
||||
|
||||
.. Note:: For hotfixes, replace 'feature/' with 'hotfix/' and base the new branch off the parent 'master' branch instead of 'develop' branch. Make sure to checkout 'master' before running step 8
|
||||
.. Note:: Let's follow the Atlassian `Gitflow Workflow <https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow>`_, except for one main difference - submitting a pull request rather than merging by ourselves.
|
||||
.. Note:: See `here <https://philna.sh/blog/2018/08/21/git-commands-to-keep-a-fork-up-to-date/>`_ or `here <https://stefanbauer.me/articles/how-to-keep-your-git-fork-up-to-date>`_ for instructions on how to keep a fork up to date.
|
Loading…
Reference in New Issue
Block a user