Debian Codegraph @

.github/how_to_use_github_to_contribute_to_gudhi.md

raw symbols SCIP
1 # How to use github to contribute to gudhi
2
3 Similar information is available in many places:
4 * https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch)
5 * https://help.github.com/en/github/getting-started-with-github/fork-a-repo
6 * https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/
7 * https://gist.github.com/Chaser324/ce0505fbed06b947d962
8 * etc
9
10 ## Get a github account
11 I assume the account is called **LOGIN**, please replace as appropriate below. Log in to github.com using this account.
12
13 ## Fork GUDHI/gudhi-devel project
14 Go to https://github.com/GUDHI/gudhi-devel and click on **fork** (top right).
15 Feel free to also click on the star next to it to show you like the project!
16 You can see your fork at https://github.com/LOGIN/gudhi-devel
17
18 ## Create a local clone on your computer
19 ```bash
20 git clone --recurse-submodules https://github.com/LOGIN/gudhi-devel.git
21 ```
22
23 This creates a directory gudhi-devel, which you are free to move around or rename. For the following, change to that directory:
24 ```bash
25 cd gudhi-devel
26 ```
27
28 ## Submodules
29 When you clone the repository, you also need to download the *submodules*. This is done automatically thanks to `--recurse-submodules`.
30 If you forgot this option, you can still download them with
31 ```bash
32 git submodule update --init
33 ```
34
35 The submodules appear in the `ext/` subdirectory. There are currently 2, [Hera](https://github.com/anigmetov/hera) for distances between persistence diagrams, and [gudhi-deploy](https://github.com/GUDHI/gudhi-deploy) for Continuous Integration.
36
37 ## Configuring a remote for a fork
38 ```bash
39 git remote add upstream https://github.com/GUDHI/gudhi-devel.git
40 ```
41
42 because you want to see the real gudhi, not just your clone.
43 (It is perfectly possible to do things in the reverse order, clone from GUDHI and add the one in LOGIN as extra remote, but the names of the remotes may not match the rest of this document. You can change the name of a remote with `git remote rename oldname newname`)
44
45 ## Optional remotes
46 Optional, if you are interested in one of the old branches
47 ```bash
48 git remote add oldies https://github.com/GUDHI/branches.git
49 ```
50
51 Or if you want to spy on someone's work. I assume the someone's account is called **SOMEONE**
52 ```bash
53 git remote add someone https://github.com/SOMEONE/gudhi-devel.git
54 ```
55
56 ## Stay up-to-date
57 ```bash
58 git fetch -p --all
59 ```
60 This is a command you can run quite regularly.
61 It tells git to check all that happened on github.
62 It is safe, it will not mess with your files.
63
64 **Reminder:** If the version of a submodule has changed, or if a submodule was added, you may need to:
65 ```bash
66 git submodule sync
67 git submodule update --init
68 ```
69 You can configure `git` to do this automatically with
70 ```bash
71 git config submodule.recurse true
72 ```
73 (add `--global` if you want it to apply to other projects as well)
74
75 ## Create a branch, based on the current master
76 ```bash
77 git checkout -b some-fancy-name --no-track upstream/master
78 ```
79 Your local branch `master` and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on.
80
81 ## The real coding is here!
82 Edit files, test, etc.
83
84 ## Commit your changes (locally)
85 The basic command is just `git commit`, but it will do nothing by default.
86 You need `git add my_new_file` for every new file you want to commit.
87 And usually you'll want to use `git commit -a` so that all files that git already knows about and that have been modified get committed.
88
89 ## Push your changes (remotely)
90 ```bash
91 git push -u origin some-fancy-name
92 ```
93 This puts a copy of your branch on your online clone of gudhi-devel.
94 Because of `-u`, it will remember where you like to push this branch, and next time you can just use `git push`.
95
96 ## Play again!
97 Possibly iterate a few times, add more commits and push them.
98
99 ## Your pull request is ready
100 Do not forget to update `.github/next_release.md` to announce your development in the next release note.
101
102 Get your web browser to https://github.com/LOGIN/gudhi-devel, click on the button that says **Branch: some-name** (below the number of commits, above the list of files) and select the branch you are so proud of.
103 Click on **New pull request** next to it.
104
105 ## Follow the instructions ;-)
106 Note that if your branch is not quite ready, you can make a **draft pull request** (see the arrow next to the confirmation button), and later you will have access to a button to say that the branch is ready for reviews now.
107 Draft pull requests can be a way to advertise that you are working on something, and possibly ask others for comments or help.
108
109 ## Code review
110 Make sure you follow the discussion on your pull request, answer questions, take comments into account.
111 You can keep pushing new commits on your branch to your fork of gudhi-devel, the pull request will automatically notice the new commits there.
112 There is no need to create a new pull request.
113 Once the branch is under review, fixing issues is good, but please refrain from adding extra features, that just makes the reviewers' job harder and thus slower.
114 You may want to look at https://github.com/settings/notifications (and other settings nearby) if you don't receive emails when people comment on your pull request.
115 Some bold reviewer might make changes to your branch. You will then need `git pull` for your local branch to reflect those.
116
117 ## Your work is merged!
118 Once your pull request has been closed (your branch merged), you can remove your branch, both locally and also the branch on your github fork:
119 ```bash
120 git checkout master # or any other branch, but you cannot remove the branch you are currently in
121 git branch -d some-fancy-name # local branch delete
122 git push origin --delete some-fancy-name # remote branch delete
123 ```
124 If you add @VincentRouvreau or @mglisse as collaborator (https://github.com/LOGIN/gudhi-devel/settings/collaboration), they may remove the branch on your clone at the same time as they merge the branch, so you only have the local one to remove (or keep if you are nostalgic).
125
126 ## Keep in touch
127 Create a new branch and keep contributing!
128
129 Do not try to reuse an old branch that has already been merged.
130 Make sure you run the fetch command just before creating any new branch, so you don't base it on some outdated version of master.
131 You can also work on several branches at the same time, using `git checkout some-fancy-name` and `git checkout name-of-other-branch` to switch between them (commit before switching or things may get complicated).