33
44### Typical Development Cycle
55
6- {% if page %}
7- ::::{grid} 1 2 2 2
6+
7+ ::::{admonition} Best Practice
8+ :class: tip margin
9+ Clear commit messages are essential for reference and orientation.
10+
11+ :::{image} https://imgs.xkcd.com/comics/git_commit.png
12+ :alt: Git Commit
13+ :align: center
14+ :width: 100%
15+ :class: sd-m-auto
16+
17+ {.smaller}
18+ * Source* : [ xkcd.com/1296] ( https://xkcd.com/1296 )
19+ :::
20+ ::::
21+
22+
23+ ::::::{grid} 1 2 2 2
824:gutter: 2
925
10- :::{grid-item}
26+ :::::{grid-item}
27+ :columns: {% if slide %}5{% else %}6{% endif %}
1128:class: sd-m-auto
29+ {% if page %}
1230
1331First, code is fetched from a remote repository to a local machine utilizing ` git clone ` (for initial setup) or ` git pull ` (for updates).
1432Modifications are then made within the local working directory and staged via ` git add ` .
1533Subsequently, these modifications are permanently recorded to the local repository's history through ` git commit ` .
1634Finally, the updated local history is uploaded back to the remote repository utilizing ` git push ` .
1735
18- :::
19- :::{grid-item}
20- :class: sd-m-auto
2136
22- {% endif %}
37+ {% else %}
2338
24- {% if slide %}
25- ::::{grid} 1 2 2 2
39+ ::::{tab-set}
2640:gutter: 2
2741
28- :::{grid-item}
29- :class: sd-m-auto
30- {% endif %}
31-
32- ``` text
33- ┌──────────┐
34- │ Remote │
35- │Repository│
36- └────┬─────┘
37- │ git clone / git pull
38- ▼
39- ┌──────────┐
40- │ Local │ git add
41- │Repository│ ◄─────── Working Directory
42- └────┬─────┘
43- │ git commit
44- │
45- ▼ git push
46- ┌──────────┐
47- │ Remote │
48- │Repository│
49- └──────────┘
50- ```
42+ :::{tab-item} Setup & Clone
5143
52- {% if slide %}
53- :::
54- :::{grid-item}
55- :class: sd-m-auto
44+ ``` bash
45+ # Configure author identity
46+ git config --global user.name " Author Name "
47+ git config --global user.email " author@example.com "
5648
57- :::{grid-item}
58- :class: sd-m-auto
59- {% else %}
49+ # Get a repository
50+ git clone < url >
51+ ```
6052:::
61- {% endif %}
53+ :::{tab-item} Daily Work
6254
63- :::{admonition} Best Practice
64- :class: tip {% if page %}margin{% endif %}
65- Clear commit messages are essential for reference and orientation.
55+ ``` bash
56+ # Check repository status
57+ git status
6658
67- :::{image} https://imgs.xkcd.com/comics/git_commit.png
68- :alt: Git Commit
69- :align: center
70- :width: {% if page %}100%{% else %}60%{% endif %}
71- :class: sd-m-auto
59+ # Stage changes
60+ git add < file>
7261
73- {.smaller}
74- * Source* : [ xkcd.com/1296] ( https://xkcd.com/1296 )
62+ # Commit changes
63+ git commit -m " Descriptive message"
64+ ```
7565:::
7666
67+ :::{tab-item} Sync
7768
78- {% if page %}
69+ ``` bash
70+ # Get latest changes
71+ git pull
7972
73+ # Send changes to remote
74+ git push
75+ ```
8076:::
8177::::
78+ {% endif %}
79+ :::::
80+ :::::{grid-item}
81+ :columns: {% if slide %}7{% else %}6{% endif %}
82+ :class: sd-m-auto
83+ ``` {image} ./../_static/gitWorkflow.png
84+ :alt: Git Workflow
85+ :width: 100%
86+ ```
87+ :::::
88+ ::::::
89+
90+
91+ {% if page %}
8292
8393The basic Git workflow involves moving changes through different stages, from a local working directory to a remote repository where they can be accessed by others.
8494
@@ -94,86 +104,49 @@ Git operates using three main states for files:
94104 The committed history safely stored in the ` .git ` directory.
95105
96106This three-stage model provides fine-grained control over what is recorded in the project history.
97- {% endif %}
98107
99108### Essential Commands
100109
101- {% if slide %}
102- ::::{tab-set}
103- :gutter: 2
104-
105- :::{tab-item} Setup & Clone
106- {% else %}
107110** Initial setup** (one-time configuration):
108- {% endif %}
109111
110112``` bash
111113# Configure author identity
112114git config --global user.name " Author Name"
113115git config --global user.email " author@example.com"
114116
115- {% if slide %}# Get a repository
116- git clone < url>
117- {% else %}# Clone an existing repository
117+ # Clone an existing repository
118118git clone https://github.com/username/repository.git
119- {% endif %}
120119```
121120
122- {% if slide %}
123- :::
124-
125- :::{tab-item} Daily Work
126- {% else %}
127121** Daily workflow** :
128- {% endif %}
129122
130123``` bash
131124# Check repository status
132125git status
133126
134- {% if slide %}# Stage changes
135- git add < file> {% else %}# Stage specific files
136- git add analysis.py figures/plot.png{% endif %}
127+ # Stage specific files
128+ git add analysis.py figures/plot.png
137129
138130# Stage all changes
139131git add .
140- {% if slide %}
141- # Commit changes
142- git commit -m " Descriptive message"
143- {% else %}
144132# Create a commit
145133git commit -m " Add correlation analysis and visualization"
146134
147135# View commit history
148136git log --oneline
149- {% endif %}
150137
151138```
152139
153- {% if slide %}
154- :::
155-
156- :::{tab-item} Sync with Remote
157- {% else %}
158140** Synchronizing with remotes** :
159- {% endif %}
160141
161142``` bash
162- {% if slide %} # Get latest changes{% else %}# Fetch and merge changes from remote{% endif %}
143+ # Fetch and merge changes from remote
163144git pull
164145
165146# Send changes to remote
166147git push
167148
168149```
169-
170- {% if slide %}
171- :::
172- ::::
173- {% endif %}
174-
175-
176- {% if page %}
177150### Working with Branches
178151
179152Branches allow features to be developed in isolation:
@@ -191,12 +164,22 @@ git checkout main
191164git merge feature-analysis
192165
193166```
167+ ### Commit Message Best Practices
194168
195- {% endif %}
169+ ::::{admonition} Best Practice
170+ :class: tip margin
171+ Clear commit messages are essential for reference and orientation.
196172
173+ :::{image} https://imgs.xkcd.com/comics/git_commit.png
174+ :alt: Git Commit
175+ :align: center
176+ :width: 100%
177+ :class: sd-m-auto
197178
198- {% if page %}
199- # ## Commit Message Best Practices
179+ {.smaller}
180+ * Source* : [ xkcd.com/1296] ( https://xkcd.com/1296 )
181+ :::
182+ ::::
200183
201184Good commit messages are essential for maintaining a usable project history[ ^ 1 ] ([ xkcd.com/1296] ( https://xkcd.com/1296 ) ):
202185
@@ -215,5 +198,4 @@ normalization to ensure consistent input ranges for downstream analysis.
215198Fixes issue #42."
216199
217200```
218-
219201{% endif %}
0 commit comments