You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: coredev/git.md
+29-37Lines changed: 29 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,31 +7,34 @@ myst:
7
7
"keywords": ""
8
8
---
9
9
10
-
% -*- coding: utf-8 -*-
10
+
```{todo}
11
+
I seriously question the value of this entire guide.
12
+
I think it should be purged.
13
+
Plone should not be in the business of teaching how to use git or GitHub.
14
+
```
11
15
12
16
# Working with Git and GitHub
13
17
14
-
## The Plone Git workflow & branching model
18
+
## The Plone Git workflow and branching model
15
19
16
20
Our repository on GitHub has the following layout:
17
21
18
-
-**feature branches**:
19
-
all development for new features must be done in dedicated branches, normally one branch per feature,
20
-
-**main** or **master****branch**:
21
-
when features get completed they are merged into the master branch;
22
-
bugfixes are commited directly on the master branch,
23
-
-**tags**:
24
-
whenever we create a new release we tag the repository so we can later re-trace our steps, re-release versions, etc.
22
+
-**feature branches**:
23
+
All development for new features must be done in dedicated branches, normally one branch per feature.
24
+
-**main** or **master****branch**:
25
+
when features get completed they are merged into the master branch; bugfixes are commited directly on the master branch,
26
+
-**tags**:
27
+
whenever we create a new release, we tag the repository so we can later retrace our steps, or rerelease versions.
28
+
25
29
26
-
## Git Basics
30
+
## Git basics
31
+
32
+
Some introductory definitions and concepts, if you are already familiar enough with Git, head to next section: {ref}`general-guidelines-label`.
27
33
28
-
Some introductory definitions and concepts, if you are already familiar enough with Git,
29
-
head to next section: {ref}`general-guidelines-label`.
30
34
31
35
### Mental working model
32
36
33
-
With Git (as well as all modern [DVCS](http://en.wikipedia.org/wiki/Distributed_revision_control)),
34
-
distributing changes to others is a two steps process (contrary to traditional VCS like `svn`).
37
+
With Git (as well as all modern [DVCS](http://en.wikipedia.org/wiki/Distributed_revision_control)), distributing changes to others is a two steps process (contrary to traditional VCS like `svn`).
35
38
36
39
This way what on svn is a single `svn ci` in Git is two commands: `git commit` and `git push`.
37
40
@@ -45,6 +48,7 @@ You can freely fix/change/remove/rework/update/... your commits afterwards.
45
48
46
49
Push your changes whenever you are sure they are what you, and others, expect them to be.
47
50
51
+
48
52
### Concepts
49
53
50
54
In Git there are:
@@ -63,28 +67,22 @@ tags
63
67
64
68
`HEAD`
65
69
66
-
: A pointer that always tells you where you are
67
-
(extremely useful when doing some operations).
70
+
: A pointer that always tells you where you are (extremely useful when doing some operations).
68
71
69
72
The index
70
73
71
74
: A temporal staging storage with changes on files that are pending to be added to a commit.
72
-
If your Git output is colored,
73
-
green filenames are those in the index.
75
+
If your Git output is colored, green filenames are those in the index.
74
76
75
77
Working tree
76
78
77
79
: Your current modified files.
78
80
This is the only place where you can loose your changes.
79
-
If your Git output is colored,
80
-
red filenames are those in the working tree.
81
+
If your Git output is colored, red filenames are those in the working tree.
81
82
82
83
Stash
83
84
84
-
: Temporal storage for changes,
85
-
again,
86
-
extremely useful in some scenarios,
87
-
see further below for examples.
85
+
: Temporal storage for changes, again, extremely useful in some scenarios, see further below for examples.
88
86
89
87
### Branches
90
88
@@ -115,37 +113,31 @@ add
115
113
116
114
: Add the given files to the index.
117
115
118
-
:::{note}
116
+
```{note}
119
117
**pro tip**: once a file is add via `git add` your changes will never be lost!
120
-
As long as you don't remove the `.git` folder,
121
-
even if you remove the file you just added,
122
-
the changes you made before doing `git add` are still there ready to be recovered at any time!
123
-
:::
118
+
As long as you don't remove the `.git` folder, even if you remove the file you just added, the changes you made before doing `git add` are still there ready to be recovered at any time!
119
+
```
124
120
125
121
status
126
122
127
123
: Get an overview of the repository status.
128
124
129
-
If there are files on the index,
130
-
or files not tracked by Git,
131
-
or the status of your local branch with regards to the remote,
132
-
etc.
125
+
If there are files on the index, or files not tracked by Git, or the status of your local branch with regards to the remote, etc.
133
126
134
127
diff
135
128
136
129
: See the current changes made to the files already tracked by Git.
137
130
138
-
:::{note}
131
+
```note}
139
132
Fear not, if you used `git add SOME_FILE` and then `git diff` doesn't output anything you haven't lost your changes!
140
133
141
134
Just try `git diff --cached`.
142
135
Now you know how to see the working tree changes (`git diff`) and index changes (`git diff --cached`).
143
-
:::
136
+
```
144
137
145
138
commit
146
139
147
-
: Create/record changes to the repository
148
-
(locally only, nothing is sent over the wire).
140
+
: Create/record changes to the repository (locally only, nothing is sent over the wire).
0 commit comments