88# Git branching strategy
99
1010The general workflow is to branch off from the latest version's branch, perform
11- your changes, open a pull request, and merge your updates. An open pull request
12- can finalise a version, or patch it with updates.
11+ your changes, open a pull request, and merge your updates.
1312
1413## Branching strategy
1514
16- For new versions, branch off from the latest version. This is usually done by
17- maintainers. Call the branch as ` vX ` , where ` X ` is the new version number,
18- the successor of the latest version. To find the latest version, check the
19- ` VERSION ` file in the repository root. For example, if the latest version is
20- ` v1 ` , the new version branch will be ` v2 ` , and the git graph will look like:
15+ ### For changes to the latest version
16+
17+ For changes to the latest version, branch off from ` main ` . Name your branch by
18+ prefixing your name and an issue identifier, like ` your-name/issue-identifier ` .
19+
20+ ``` bash
21+ git checkout main
22+ git checkout -b your-name/issue-identifier
23+ ```
24+
25+ ### For changes to older published versions
26+
27+ For patching older versions, branch off from the specific version branch.
28+ Published versions follow the pattern ` vX ` , where ` X ` is the version number.
29+ For example, say the latest version is ` v0.1.0 ` .
30+
31+ ``` bash
32+ git checkout v0.1.0
33+ ```
34+
35+ Name your branch by prefixing your name and an patch topic, like
36+ ` your-name/patch-topic ` .
37+
38+ ``` bash
39+ git checkout -b your-name/patch-topic
40+ ```
41+
42+ The git graph will look like:
2143
2244``` mermaid
2345%%{init: { 'theme': 'neutral' } }%%
2446gitGraph:
2547 commit
26- branch v1
27- checkout v1
48+ branch vX
49+ checkout vX
2850 commit
2951 branch your-name/issue-identifier
3052 checkout your-name/issue-identifier
3153 commit
32- checkout v1
54+ checkout vX
3355 merge your-name/issue-identifier
34- commit
35- commit tag: "v1"
36- branch v2
37- checkout v2
38- commit
39- commit id:"still in development"
4056```
4157
42- !!! info
43-
44- The branch `vX` is the base branch for all new features and patches for the
45- version `X`. That means that, even when there are new versions, the branch `vX`
46- can still be used for patches and minor updates to the version `X`.
47-
48-
49- ## Merging finalised versions
50-
51- 2 . To merge a finalised version:
52-
53- - Open a pull request against the version in development.
54- - Pass all CI checks.
55- - Tag it with the ` vX ` label.
56- - Merge the pull request.
57-
58- ### Adding new features to the current version
59-
60- For patches or minor updates, again, branch off from the latest version. Name
61- your branch prefixing your name and an issue identifier, like
62- ` your-name/issue-identifier ` . Short descriptive labels are recommended, like
63- ` fix-typo ` , or ` new-solver-engine ` . So, the steps are:
64-
65- 1 . ** Fetch the latest changes** :
66- ``` bash
67- git fetch --all
68- ```
69- 2. ** Create a new branch** :
70- ` ` ` bash
71- git checkout vX # Replace vX with the current version
72- git checkout -b your-name/issue-identifier
73- ` ` `
74- 3. Open a pull request against the version in development. If you are using
75- ` gh` , after pushing your changes, you can create a pull request with:
76-
77- ` ` ` bash
78- gh pr create
79- ` ` `
58+ So, if your PR is merged, the changes will be incorporated into the version
59+ branch and on the website.
8060
8161### Rebasing your work
8262
@@ -94,34 +74,41 @@ the following.
9474- Initiate the rebase onto the target branch:
9575
9676 ` ` ` bash
97- git pull origin vX --rebase
77+ git pull origin main --rebase
9878 ` ` `
9979
100- Or merge the changes from the base branch:
80+ Or merge the changes from the base branch which is convenient most of the
81+ time:
10182
10283 ` ` ` bash
103- git merge vX
84+ git merge main
10485 ` ` `
10586
10687# ### Resolve conflicts
10788
10889- Git will pause for conflict resolution.
10990- After resolving each conflict:
110- ` ` ` bash
111- git rebase --continue
112- ` ` `
91+
92+ ` ` ` bash
93+ git rebase --continue
94+ ` ` `
95+
11396- To stop the rebase process:
114- ` ` ` bash
115- git rebase --abort
116- ` ` `
97+
98+ ` ` ` bash
99+ git rebase --abort
100+ ` ` `
117101
118102# ### Push your changes
119103
120104- Once rebase is complete, push changes:
105+
121106 ` ` ` bash
122107 git push origin your-name/issue-identifier
123108 ` ` `
109+
124110- A force push may be required:
111+
125112 ` ` ` bash
126113 git push origin your-name/issue-identifier --force-with-lease
127114 ` ` `
0 commit comments