File tree Expand file tree Collapse file tree 3 files changed +51
-15
lines changed Expand file tree Collapse file tree 3 files changed +51
-15
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,35 @@ done
354354
355355---
356356
357+ ## Associative arrays
358+
359+ These act as dictionaries or hashmaps in other languages allowing you to store key - value pairs.
360+
361+ ``` bash
362+ # define an associative array
363+ declare -A PETS
364+
365+ PETS[" Norwegian" ]=" cat"
366+ PETS[" Dane" ]=" horse"
367+ PETS[" Brit" ]=" bird"
368+ PETS[" German" ]=" ?"
369+ ```
370+
371+ ---
372+
373+ ``` bash
374+ # Read the value for a given key
375+ echo ${PETS['Brit']}
376+
377+ # Adding new values
378+ PETS[" Swede" ]=" dog"
379+
380+ # Alternative syntax for adding elements
381+ PETS+=([" Bulgarian" ]=" goat" )
382+ ```
383+
384+ ---
385+
357386## Handling inputs
358387
359388There are special variable that allow you to handle script arguments.
Original file line number Diff line number Diff line change @@ -48,6 +48,19 @@ The `.git` directory is where git stores all its internal state:
4848
4949---
5050
51+ ## What commit is my branch pointing to?
52+
53+ ``` bash
54+ git rev-parse branch-name
55+ # prints the sha of the commit that
56+ # the given branch is pointing to
57+
58+ git rev-parse --short branch-name
59+ # prints a short commit sha
60+ ```
61+
62+ ---
63+
5164<class-work >
5265
5366### Create a branch by hand
@@ -129,6 +142,10 @@ git cat-file -p HEAD^{commit}
129142
130143---
131144
145+ ![ sharing objects between commits] ( https://git-scm.com/book/en/v2/images/data-model-3.png )
146+
147+ <bonus-content >
148+
132149### Optimized for efficiency
133150
134151Git splits the SHA of objects to allow large repositories
@@ -137,6 +154,8 @@ to work on file systems with small limits
137154
138155> This also increases efficiency under any file system
139156
157+ </bonus-content >
158+
140159---
141160
142161<class-work >
@@ -220,19 +239,6 @@ echo 'commit message' | git commit-tree \
220239
221240---
222241
223- ## What commit is my branch pointing to?
224-
225- ``` bash
226- git rev-parse branch-name
227- # prints the sha of the commit that
228- # the given branch is pointing to
229-
230- git rev-parse --short branch-name
231- # prints a short commit sha
232- ```
233-
234- ---
235-
236242<bonus-content >
237243
238244## Other meta refs
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ the same parts of the project
6161New features are developed on their own branch.
6262
6363- ** PRO** : keeps development isolated, conflicts only happen after a big merge
64+
6465- ** CON** : stacking feature branches can lead to complex merge trains
6566
6667> ** GOOD PRACTICE** : update feature branches often by merging main into them
@@ -118,9 +119,9 @@ You can merge into main locally and push the resulting commits manually.
118119
119120---
120121
121- However pull requests provide an explicit way for review, discussion and approval.
122+ However pull requests provide an ** explicit** mechanism for review, discussion and approval.
122123
123- Most git hosting providers have additional tools and controls to make reviews mandatory.
124+ Most git hosting providers have additional tools and controls to make these processes easier and mandatory.
124125
125126---
126127
You can’t perform that action at this time.
0 commit comments