File: git_workflow.rst

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (150 lines) | stat: -rw-r--r-- 3,578 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Git workflow
============

Proposing a pull request
------------------------

Patches are welcome to our library repository: https://github.com/openturns/openturns.

Here are the steps required to propose a modification with git:

1. Setup git for first time use::

    git config --global user.name "John Doe"
    git config --global user.email "johndoe@example.com"
    git config --global branch.autosetuprebase remote


2. Register on `GitHub <https://github.com>`_ and add a new ssh key in https://github.com/settings/ssh::

    ssh-keygen -t ed25519 -C "johndoe@example.com"
    cat ~/.ssh/id_ed25519.pub


3. Fork the library repository https://github.com/openturns/openturns and clone it via ssh::

    git clone git@github.com:doe/openturns.git doe
    cd doe


4. Create a branch from master with a relevant topic name::

    git checkout -b branch_name master


5. Commit your changes, split your work in several commits if needed to ease reviewing.
   You want to avoid including several unrelated tasks into a single commit.::

    git add <files> # Add current state of files to commit
    git commit
    ...
    git add <files>
    git commit

To write a nice commit message, keep a short commit title (less than 50 characters),
leave a blank line, then add a more detailed description.
It can be useful to prefix the title with the class or area in the library
concerned by the commit.
If the commit fixes an issue, add `Closes #NNN` to the message body that
way it will be closed automatically on merge.
For example::

    QuadraticLeastSquares: Fix quadratic term

    Closes #2412

Also update the ChangeLog file accordingly.

6. Push the new branch to your personal repository::

    git push --set-upstream origin branch_name


7. Create a pull request on https://github.com/openturns/openturns

That's it, your code is ready for reviewing, but it may not be accepted as is.

Checkout the comments made after your pull request and the automated test result.

You may want to push more commits to that branch as required.

Propose a separate pull request for each topic you want to address.

Here are more resources on `using pull requests <https://help.github.com/articles/using-pull-requests/>`_
and `Git <https://git-scm.com/book/en/v2>`_.


Keep your local repository in sync
----------------------------------

You may want to keep your personal repository in sync with the main repository
before starting new developments.

1. Add upstream remote repository::

    git remote add upstream https://github.com/openturns/openturns.git


2. Retrieve usptream::

    git fetch upstream


3. Create a new branch from the main repository master branch::

    git checkout -b new_branch_name upstream/master


You may also want to synchronize your current topic branch with the main repository:

1. Add upstream remote repository::

    git remote add upstream https://github.com/openturns/openturns.git


2. Retrieve usptream::

    git fetch upstream


3. Rebase your current branch to the main repository master branch::

    git rebase upstream/master


Delete a branch
---------------

Once your pull-request is merged, you may want to delete the branch.

1. Delete local branch::

    git branch -d branch_name


2. Delete remote branch::

    git push origin :branch_name


Tagging a release
-----------------

0. List existing tags::

    git tag


1. Get the master branch::

    git checkout master


2. Create the tag on local repository::

    git tag -a v2.0 -m 'version 2.0'


3. Push the tag on the remote repository::

    git push origin v2.0