@vetala/vetala 0.1.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @vetala/vetala might be problematic. Click here for more details.

Files changed (271) hide show
  1. package/CONTRIBUTING.md +77 -0
  2. package/LICENSE +184 -0
  3. package/README.md +136 -0
  4. package/THIRD_PARTY_LICENSES.md +17 -0
  5. package/dist/src/agent.d.ts +30 -0
  6. package/dist/src/agent.js +216 -0
  7. package/dist/src/agent.js.map +1 -0
  8. package/dist/src/approvals.d.ts +18 -0
  9. package/dist/src/approvals.js +81 -0
  10. package/dist/src/approvals.js.map +1 -0
  11. package/dist/src/cli.d.ts +2 -0
  12. package/dist/src/cli.js +87 -0
  13. package/dist/src/cli.js.map +1 -0
  14. package/dist/src/config.d.ts +12 -0
  15. package/dist/src/config.js +183 -0
  16. package/dist/src/config.js.map +1 -0
  17. package/dist/src/context-memory.d.ts +7 -0
  18. package/dist/src/context-memory.js +96 -0
  19. package/dist/src/context-memory.js.map +1 -0
  20. package/dist/src/ink/command-suggestions.d.ts +7 -0
  21. package/dist/src/ink/command-suggestions.js +179 -0
  22. package/dist/src/ink/command-suggestions.js.map +1 -0
  23. package/dist/src/ink/ink-terminal-ui.d.ts +36 -0
  24. package/dist/src/ink/ink-terminal-ui.js +79 -0
  25. package/dist/src/ink/ink-terminal-ui.js.map +1 -0
  26. package/dist/src/ink/repl-app.d.ts +9 -0
  27. package/dist/src/ink/repl-app.js +789 -0
  28. package/dist/src/ink/repl-app.js.map +1 -0
  29. package/dist/src/ink/transcript-cards.d.ts +6 -0
  30. package/dist/src/ink/transcript-cards.js +24 -0
  31. package/dist/src/ink/transcript-cards.js.map +1 -0
  32. package/dist/src/path-policy.d.ts +11 -0
  33. package/dist/src/path-policy.js +67 -0
  34. package/dist/src/path-policy.js.map +1 -0
  35. package/dist/src/process-utils.d.ts +13 -0
  36. package/dist/src/process-utils.js +52 -0
  37. package/dist/src/process-utils.js.map +1 -0
  38. package/dist/src/repl.d.ts +9 -0
  39. package/dist/src/repl.js +13 -0
  40. package/dist/src/repl.js.map +1 -0
  41. package/dist/src/sarvam/client.d.ts +15 -0
  42. package/dist/src/sarvam/client.js +208 -0
  43. package/dist/src/sarvam/client.js.map +1 -0
  44. package/dist/src/sarvam/models.d.ts +2 -0
  45. package/dist/src/sarvam/models.js +7 -0
  46. package/dist/src/sarvam/models.js.map +1 -0
  47. package/dist/src/search-provider.d.ts +6 -0
  48. package/dist/src/search-provider.js +8 -0
  49. package/dist/src/search-provider.js.map +1 -0
  50. package/dist/src/session-store.d.ts +19 -0
  51. package/dist/src/session-store.js +318 -0
  52. package/dist/src/session-store.js.map +1 -0
  53. package/dist/src/skills/runtime.d.ts +26 -0
  54. package/dist/src/skills/runtime.js +317 -0
  55. package/dist/src/skills/runtime.js.map +1 -0
  56. package/dist/src/skills/types.d.ts +25 -0
  57. package/dist/src/skills/types.js +2 -0
  58. package/dist/src/skills/types.js.map +1 -0
  59. package/dist/src/terminal-ui.d.ts +29 -0
  60. package/dist/src/terminal-ui.js +236 -0
  61. package/dist/src/terminal-ui.js.map +1 -0
  62. package/dist/src/tools/filesystem.d.ts +2 -0
  63. package/dist/src/tools/filesystem.js +622 -0
  64. package/dist/src/tools/filesystem.js.map +1 -0
  65. package/dist/src/tools/git.d.ts +2 -0
  66. package/dist/src/tools/git.js +326 -0
  67. package/dist/src/tools/git.js.map +1 -0
  68. package/dist/src/tools/index.d.ts +6 -0
  69. package/dist/src/tools/index.js +21 -0
  70. package/dist/src/tools/index.js.map +1 -0
  71. package/dist/src/tools/registry.d.ts +15 -0
  72. package/dist/src/tools/registry.js +59 -0
  73. package/dist/src/tools/registry.js.map +1 -0
  74. package/dist/src/tools/shell.d.ts +2 -0
  75. package/dist/src/tools/shell.js +97 -0
  76. package/dist/src/tools/shell.js.map +1 -0
  77. package/dist/src/tools/skill.d.ts +3 -0
  78. package/dist/src/tools/skill.js +130 -0
  79. package/dist/src/tools/skill.js.map +1 -0
  80. package/dist/src/tools/web.d.ts +3 -0
  81. package/dist/src/tools/web.js +144 -0
  82. package/dist/src/tools/web.js.map +1 -0
  83. package/dist/src/types.d.ts +236 -0
  84. package/dist/src/types.js +2 -0
  85. package/dist/src/types.js.map +1 -0
  86. package/dist/src/workspace-trust.d.ts +3 -0
  87. package/dist/src/workspace-trust.js +31 -0
  88. package/dist/src/workspace-trust.js.map +1 -0
  89. package/dist/src/xdg.d.ts +9 -0
  90. package/dist/src/xdg.js +77 -0
  91. package/dist/src/xdg.js.map +1 -0
  92. package/package.json +57 -0
  93. package/skill/agents-md-generator/SKILL.md +75 -0
  94. package/skill/agents-md-generator/references/agents_md_template.md +160 -0
  95. package/skill/agents-md-generator/references/loc_measurement.md +67 -0
  96. package/skill/agents-md-generator/references/monorepo_detection.md +78 -0
  97. package/skill/agents-md-generator/references/monorepo_strategy.md +60 -0
  98. package/skill/agents-md-generator/references/read_only_commands.md +151 -0
  99. package/skill/agents-md-generator/references/update_strategy.md +160 -0
  100. package/skill/agents-md-generator/references/working_agreements.md +53 -0
  101. package/skill/biz-opportunity-scout/SKILL.md +53 -0
  102. package/skill/biz-opportunity-scout/references/competitive_analysis.md +84 -0
  103. package/skill/biz-opportunity-scout/references/market_sizing.md +68 -0
  104. package/skill/biz-opportunity-scout/references/pmf_indicators.md +94 -0
  105. package/skill/biz-opportunity-scout/references/report_template.md +243 -0
  106. package/skill/biz-opportunity-scout/references/unit_economics.md +97 -0
  107. package/skill/code-review/SKILL.md +86 -0
  108. package/skill/code-review/references/change_analysis.md +116 -0
  109. package/skill/code-review/references/git_operations.md +115 -0
  110. package/skill/code-review/references/impact_detection.md +149 -0
  111. package/skill/code-review/references/output_format.md +137 -0
  112. package/skill/code-review/references/severity_criteria.md +100 -0
  113. package/skill/code-security-audit/SKILL.md +123 -0
  114. package/skill/code-security-audit/references/audit_process.md +277 -0
  115. package/skill/code-security-audit/references/remediation_patterns.md +599 -0
  116. package/skill/code-security-audit/references/report_format.md +391 -0
  117. package/skill/code-security-audit/references/security_domains.md +830 -0
  118. package/skill/code-security-audit/references/vulnerability_patterns.md +813 -0
  119. package/skill/composition-patterns/SKILL.md +83 -0
  120. package/skill/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
  121. package/skill/composition-patterns/rules/architecture-compound-components.md +112 -0
  122. package/skill/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
  123. package/skill/composition-patterns/rules/patterns-explicit-variants.md +100 -0
  124. package/skill/composition-patterns/rules/react19-no-forwardref.md +42 -0
  125. package/skill/composition-patterns/rules/state-context-interface.md +191 -0
  126. package/skill/composition-patterns/rules/state-decouple-implementation.md +113 -0
  127. package/skill/composition-patterns/rules/state-lift-state.md +125 -0
  128. package/skill/deploy-to-vercel/SKILL.md +293 -0
  129. package/skill/deploy-to-vercel/resources/deploy-sandbox.sh +301 -0
  130. package/skill/deploy-to-vercel/resources/deploy.sh +301 -0
  131. package/skill/doc/SKILL_GUIDELINES.md +138 -0
  132. package/skill/git-workflow/SKILL.md +94 -0
  133. package/skill/git-workflow/references/advanced-git.md +632 -0
  134. package/skill/git-workflow/references/branching-strategies.md +344 -0
  135. package/skill/git-workflow/references/ci-cd-integration.md +683 -0
  136. package/skill/git-workflow/references/code-quality-tools.md +351 -0
  137. package/skill/git-workflow/references/commit-conventions.md +439 -0
  138. package/skill/git-workflow/references/github-releases.md +288 -0
  139. package/skill/git-workflow/references/pull-request-workflow.md +773 -0
  140. package/skill/git-workflow/scripts/verify-git-workflow.sh +263 -0
  141. package/skill/jetbrains-vmoptions/SKILL.md +51 -0
  142. package/skill/jetbrains-vmoptions/references/common-options.md +357 -0
  143. package/skill/jetbrains-vmoptions/references/gc-options.md +350 -0
  144. package/skill/jetbrains-vmoptions/references/memory-options.md +339 -0
  145. package/skill/jetbrains-vmoptions/references/prerequisite-check.md +65 -0
  146. package/skill/kysely-converter/SKILL.md +62 -0
  147. package/skill/kysely-converter/references/delete.md +323 -0
  148. package/skill/kysely-converter/references/insert.md +386 -0
  149. package/skill/kysely-converter/references/operators.md +331 -0
  150. package/skill/kysely-converter/references/select.md +1000 -0
  151. package/skill/kysely-converter/references/update.md +349 -0
  152. package/skill/kysely-converter/references/window_function.md +537 -0
  153. package/skill/react-best-practices/SKILL.md +131 -0
  154. package/skill/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  155. package/skill/react-best-practices/rules/advanced-init-once.md +42 -0
  156. package/skill/react-best-practices/rules/advanced-use-latest.md +39 -0
  157. package/skill/react-best-practices/rules/async-api-routes.md +38 -0
  158. package/skill/react-best-practices/rules/async-defer-await.md +80 -0
  159. package/skill/react-best-practices/rules/async-dependencies.md +51 -0
  160. package/skill/react-best-practices/rules/async-parallel.md +28 -0
  161. package/skill/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  162. package/skill/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  163. package/skill/react-best-practices/rules/bundle-conditional.md +31 -0
  164. package/skill/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  165. package/skill/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  166. package/skill/react-best-practices/rules/bundle-preload.md +50 -0
  167. package/skill/react-best-practices/rules/client-event-listeners.md +74 -0
  168. package/skill/react-best-practices/rules/client-localstorage-schema.md +71 -0
  169. package/skill/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  170. package/skill/react-best-practices/rules/client-swr-dedup.md +56 -0
  171. package/skill/react-best-practices/rules/js-batch-dom-css.md +107 -0
  172. package/skill/react-best-practices/rules/js-cache-function-results.md +80 -0
  173. package/skill/react-best-practices/rules/js-cache-property-access.md +28 -0
  174. package/skill/react-best-practices/rules/js-cache-storage.md +70 -0
  175. package/skill/react-best-practices/rules/js-combine-iterations.md +32 -0
  176. package/skill/react-best-practices/rules/js-early-exit.md +50 -0
  177. package/skill/react-best-practices/rules/js-hoist-regexp.md +45 -0
  178. package/skill/react-best-practices/rules/js-index-maps.md +37 -0
  179. package/skill/react-best-practices/rules/js-length-check-first.md +49 -0
  180. package/skill/react-best-practices/rules/js-min-max-loop.md +82 -0
  181. package/skill/react-best-practices/rules/js-set-map-lookups.md +24 -0
  182. package/skill/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  183. package/skill/react-best-practices/rules/rendering-activity.md +26 -0
  184. package/skill/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  185. package/skill/react-best-practices/rules/rendering-conditional-render.md +40 -0
  186. package/skill/react-best-practices/rules/rendering-content-visibility.md +38 -0
  187. package/skill/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  188. package/skill/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  189. package/skill/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  190. package/skill/react-best-practices/rules/rendering-svg-precision.md +28 -0
  191. package/skill/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  192. package/skill/react-best-practices/rules/rerender-defer-reads.md +39 -0
  193. package/skill/react-best-practices/rules/rerender-dependencies.md +45 -0
  194. package/skill/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  195. package/skill/react-best-practices/rules/rerender-derived-state.md +29 -0
  196. package/skill/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  197. package/skill/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  198. package/skill/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  199. package/skill/react-best-practices/rules/rerender-memo.md +44 -0
  200. package/skill/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  201. package/skill/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  202. package/skill/react-best-practices/rules/rerender-transitions.md +40 -0
  203. package/skill/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  204. package/skill/react-best-practices/rules/server-after-nonblocking.md +73 -0
  205. package/skill/react-best-practices/rules/server-auth-actions.md +96 -0
  206. package/skill/react-best-practices/rules/server-cache-lru.md +41 -0
  207. package/skill/react-best-practices/rules/server-cache-react.md +76 -0
  208. package/skill/react-best-practices/rules/server-dedup-props.md +65 -0
  209. package/skill/react-best-practices/rules/server-hoist-static-io.md +142 -0
  210. package/skill/react-best-practices/rules/server-parallel-fetching.md +83 -0
  211. package/skill/react-best-practices/rules/server-serialization.md +38 -0
  212. package/skill/react-native-skills/SKILL.md +115 -0
  213. package/skill/react-native-skills/rules/animation-derived-value.md +53 -0
  214. package/skill/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
  215. package/skill/react-native-skills/rules/animation-gpu-properties.md +65 -0
  216. package/skill/react-native-skills/rules/design-system-compound-components.md +66 -0
  217. package/skill/react-native-skills/rules/fonts-config-plugin.md +71 -0
  218. package/skill/react-native-skills/rules/imports-design-system-folder.md +68 -0
  219. package/skill/react-native-skills/rules/js-hoist-intl.md +61 -0
  220. package/skill/react-native-skills/rules/list-performance-callbacks.md +44 -0
  221. package/skill/react-native-skills/rules/list-performance-function-references.md +132 -0
  222. package/skill/react-native-skills/rules/list-performance-images.md +53 -0
  223. package/skill/react-native-skills/rules/list-performance-inline-objects.md +97 -0
  224. package/skill/react-native-skills/rules/list-performance-item-expensive.md +94 -0
  225. package/skill/react-native-skills/rules/list-performance-item-memo.md +82 -0
  226. package/skill/react-native-skills/rules/list-performance-item-types.md +104 -0
  227. package/skill/react-native-skills/rules/list-performance-virtualize.md +67 -0
  228. package/skill/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
  229. package/skill/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
  230. package/skill/react-native-skills/rules/navigation-native-navigators.md +188 -0
  231. package/skill/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
  232. package/skill/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
  233. package/skill/react-native-skills/rules/react-state-dispatcher.md +91 -0
  234. package/skill/react-native-skills/rules/react-state-fallback.md +56 -0
  235. package/skill/react-native-skills/rules/react-state-minimize.md +65 -0
  236. package/skill/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
  237. package/skill/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
  238. package/skill/react-native-skills/rules/scroll-position-no-state.md +82 -0
  239. package/skill/react-native-skills/rules/state-ground-truth.md +80 -0
  240. package/skill/react-native-skills/rules/ui-expo-image.md +66 -0
  241. package/skill/react-native-skills/rules/ui-image-gallery.md +104 -0
  242. package/skill/react-native-skills/rules/ui-measure-views.md +78 -0
  243. package/skill/react-native-skills/rules/ui-menus.md +174 -0
  244. package/skill/react-native-skills/rules/ui-native-modals.md +77 -0
  245. package/skill/react-native-skills/rules/ui-pressable.md +61 -0
  246. package/skill/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
  247. package/skill/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
  248. package/skill/react-native-skills/rules/ui-styling.md +87 -0
  249. package/skill/react-vite-guide/SKILL.md +101 -0
  250. package/skill/react-vite-guide/references/composition-patterns.md +709 -0
  251. package/skill/react-vite-guide/references/performance-optimization.md +1222 -0
  252. package/skill/react-vite-guide/references/vite-specific.md +385 -0
  253. package/skill/react-vite-guide/references/web-interface.md +146 -0
  254. package/skill/skill-maker/SKILL.md +52 -0
  255. package/skill/skill-maker/references/content_spec.md +67 -0
  256. package/skill/skill-maker/references/frontmatter_spec.md +96 -0
  257. package/skill/skill-maker/references/input_validation.md +90 -0
  258. package/skill/skill-maker/references/skill_structure.md +74 -0
  259. package/skill/system-prompt-creator/SKILL.md +50 -0
  260. package/skill/system-prompt-creator/references/data_format_selection.md +135 -0
  261. package/skill/system-prompt-creator/references/multi_prompt_architecture.md +386 -0
  262. package/skill/system-prompt-creator/references/prompt_structure.md +140 -0
  263. package/skill/system-prompt-creator/references/quality_criteria.md +83 -0
  264. package/skill/typst-creator/SKILL.md +51 -0
  265. package/skill/typst-creator/references/layout.md +401 -0
  266. package/skill/typst-creator/references/math.md +297 -0
  267. package/skill/typst-creator/references/scripting.md +237 -0
  268. package/skill/typst-creator/references/styling.md +217 -0
  269. package/skill/typst-creator/references/syntax.md +234 -0
  270. package/skill/web-design-guidelines/SKILL.md +35 -0
  271. package/terminal.png +0 -0
@@ -0,0 +1,632 @@
1
+ # Advanced Git Operations
2
+
3
+ ## Rewriting History
4
+
5
+ ### Interactive Rebase
6
+
7
+ ```bash
8
+ # Rebase last N commits
9
+ git rebase -i HEAD~5
10
+
11
+ # Rebase from a specific commit
12
+ git rebase -i abc1234^
13
+
14
+ # Commands available:
15
+ # p, pick - use commit
16
+ # r, reword - edit commit message
17
+ # e, edit - stop for amending
18
+ # s, squash - combine with previous (keep message)
19
+ # f, fixup - combine with previous (discard message)
20
+ # d, drop - remove commit
21
+ # x, exec - run shell command
22
+ ```
23
+
24
+ ### Squashing Commits
25
+
26
+ ```bash
27
+ # Squash last 3 commits
28
+ git rebase -i HEAD~3
29
+ # Change 'pick' to 'squash' for commits to combine
30
+
31
+ # Squash into a specific commit
32
+ git rebase -i <commit-before-first-to-squash>^
33
+
34
+ # Auto-squash fixup commits
35
+ git commit --fixup=<commit-hash>
36
+ git rebase -i --autosquash main
37
+ ```
38
+
39
+ ### Splitting Commits
40
+
41
+ ```bash
42
+ # Start interactive rebase
43
+ git rebase -i HEAD~3
44
+
45
+ # Mark commit to split with 'edit'
46
+ # When stopped at that commit:
47
+ git reset HEAD^
48
+ git add file1.js
49
+ git commit -m "feat: first change"
50
+ git add file2.js
51
+ git commit -m "feat: second change"
52
+ git rebase --continue
53
+ ```
54
+
55
+ ### Reordering Commits
56
+
57
+ ```bash
58
+ # Interactive rebase
59
+ git rebase -i HEAD~5
60
+
61
+ # In editor, reorder lines to reorder commits
62
+ # Example:
63
+ # pick abc1234 feat: feature A
64
+ # pick def5678 feat: feature B
65
+ # Changes to:
66
+ # pick def5678 feat: feature B
67
+ # pick abc1234 feat: feature A
68
+ ```
69
+
70
+ ## Cherry-Picking
71
+
72
+ ### Basic Cherry-Pick
73
+
74
+ ```bash
75
+ # Pick a single commit
76
+ git cherry-pick abc1234
77
+
78
+ # Pick multiple commits
79
+ git cherry-pick abc1234 def5678 ghi9012
80
+
81
+ # Pick a range
82
+ git cherry-pick abc1234^..def5678
83
+
84
+ # Cherry-pick without committing
85
+ git cherry-pick -n abc1234
86
+ ```
87
+
88
+ ### Cherry-Pick Options
89
+
90
+ ```bash
91
+ # Keep original author
92
+ git cherry-pick -x abc1234
93
+
94
+ # Sign off
95
+ git cherry-pick -s abc1234
96
+
97
+ # Edit commit message
98
+ git cherry-pick -e abc1234
99
+
100
+ # Continue after conflict
101
+ git cherry-pick --continue
102
+
103
+ # Abort cherry-pick
104
+ git cherry-pick --abort
105
+ ```
106
+
107
+ ### Cherry-Pick Workflow
108
+
109
+ ```bash
110
+ # Backport fix to release branch
111
+ git checkout release/1.0
112
+ git cherry-pick abc1234 # Fix from main
113
+ git push origin release/1.0
114
+
115
+ # Apply multiple fixes
116
+ git cherry-pick abc1234 def5678
117
+ # Or create a cherry-pick branch
118
+ git checkout -b cherry-pick-fixes release/1.0
119
+ git cherry-pick abc1234 def5678
120
+ git checkout release/1.0
121
+ git merge --no-ff cherry-pick-fixes
122
+ ```
123
+
124
+ ## Stashing
125
+
126
+ ### Basic Stash Operations
127
+
128
+ ```bash
129
+ # Stash current changes
130
+ git stash
131
+
132
+ # Stash with message
133
+ git stash save "Work in progress on feature X"
134
+
135
+ # List stashes
136
+ git stash list
137
+
138
+ # Apply latest stash (keep in stash list)
139
+ git stash apply
140
+
141
+ # Apply and remove from stash list
142
+ git stash pop
143
+
144
+ # Apply specific stash
145
+ git stash apply stash@{2}
146
+
147
+ # Drop a stash
148
+ git stash drop stash@{1}
149
+
150
+ # Clear all stashes
151
+ git stash clear
152
+ ```
153
+
154
+ ### Advanced Stashing
155
+
156
+ ```bash
157
+ # Stash including untracked files
158
+ git stash -u
159
+
160
+ # Stash including ignored files
161
+ git stash -a
162
+
163
+ # Stash specific files
164
+ git stash push -m "message" file1.js file2.js
165
+
166
+ # Create branch from stash
167
+ git stash branch new-branch stash@{0}
168
+
169
+ # Show stash contents
170
+ git stash show stash@{0}
171
+ git stash show -p stash@{0} # With diff
172
+
173
+ # Partial stash (interactive)
174
+ git stash -p
175
+ ```
176
+
177
+ ## Bisecting
178
+
179
+ ### Finding Bug Introduction
180
+
181
+ ```bash
182
+ # Start bisect
183
+ git bisect start
184
+
185
+ # Mark current as bad
186
+ git bisect bad
187
+
188
+ # Mark known good commit
189
+ git bisect good v1.0.0
190
+
191
+ # Git will checkout middle commit
192
+ # Test, then mark:
193
+ git bisect good # If bug not present
194
+ git bisect bad # If bug present
195
+
196
+ # Continue until found
197
+ # Git reports: "abc1234 is the first bad commit"
198
+
199
+ # End bisect
200
+ git bisect reset
201
+ ```
202
+
203
+ ### Automated Bisect
204
+
205
+ ```bash
206
+ # Run script at each step
207
+ git bisect start HEAD v1.0.0
208
+ git bisect run npm test
209
+
210
+ # With custom script
211
+ git bisect run ./test-for-bug.sh
212
+
213
+ # Exit codes:
214
+ # 0 - good
215
+ # 1-124 - bad
216
+ # 125 - skip (can't test this commit)
217
+ # 126+ - abort bisect
218
+ ```
219
+
220
+ ### Bisect Log
221
+
222
+ ```bash
223
+ # Show bisect log
224
+ git bisect log
225
+
226
+ # Save bisect log
227
+ git bisect log > bisect.log
228
+
229
+ # Replay bisect
230
+ git bisect replay bisect.log
231
+ ```
232
+
233
+ ## Reflog
234
+
235
+ ### Understanding Reflog
236
+
237
+ ```bash
238
+ # Show reflog
239
+ git reflog
240
+
241
+ # Show reflog for specific ref
242
+ git reflog show main
243
+ git reflog show HEAD
244
+
245
+ # Output:
246
+ # abc1234 HEAD@{0}: commit: feat: add feature
247
+ # def5678 HEAD@{1}: checkout: moving from main to feature
248
+ # ghi9012 HEAD@{2}: commit: fix: bug fix
249
+ ```
250
+
251
+ ### Recovering Lost Commits
252
+
253
+ ```bash
254
+ # Find lost commit in reflog
255
+ git reflog
256
+
257
+ # Recover commit
258
+ git checkout abc1234
259
+ git checkout -b recovered-branch
260
+
261
+ # Or cherry-pick
262
+ git cherry-pick abc1234
263
+
264
+ # Recover after bad reset
265
+ git reflog
266
+ git reset --hard HEAD@{2}
267
+ ```
268
+
269
+ ### Reflog Expiration
270
+
271
+ ```bash
272
+ # Default: 90 days for reachable, 30 for unreachable
273
+ git config gc.reflogExpire 90.days
274
+ git config gc.reflogExpireUnreachable 30.days
275
+
276
+ # Expire reflog manually
277
+ git reflog expire --expire=now --all
278
+ git gc --prune=now
279
+ ```
280
+
281
+ ## Worktrees
282
+
283
+ ### Multiple Working Directories
284
+
285
+ ```bash
286
+ # Add worktree
287
+ git worktree add ../project-feature feature-branch
288
+
289
+ # Add worktree with new branch
290
+ git worktree add -b new-feature ../project-new-feature main
291
+
292
+ # List worktrees
293
+ git worktree list
294
+
295
+ # Remove worktree
296
+ git worktree remove ../project-feature
297
+
298
+ # Prune stale worktree info
299
+ git worktree prune
300
+ ```
301
+
302
+ ### Use Cases
303
+
304
+ ```bash
305
+ # Work on hotfix while keeping feature work
306
+ git worktree add ../project-hotfix hotfix/critical-bug
307
+ cd ../project-hotfix
308
+ # Fix bug
309
+ git commit -am "fix: critical bug"
310
+ cd ../project-main
311
+
312
+ # Review PR without stashing
313
+ git worktree add ../pr-review origin/feature-branch
314
+ cd ../pr-review
315
+ # Review code
316
+ ```
317
+
318
+ ### Pushing to Fork Remotes (Multiple Remotes Pitfall)
319
+
320
+ When using worktrees with multiple remotes (e.g., `origin` = upstream, `fork` = your fork),
321
+ `git push fork main` can silently say "Everything up-to-date" even when the fork is behind.
322
+
323
+ **Why it fails:**
324
+ - Local `main` tracks `origin/main` (upstream), not `fork/main`
325
+ - `git push fork main` resolves the tracking ref, which may already match what git considers current
326
+ - The fork remote never receives the new commits
327
+
328
+ **Fix: Use explicit refspec with `HEAD:main`**
329
+
330
+ ```bash
331
+ # WRONG - may silently do nothing
332
+ git push fork main
333
+
334
+ # CORRECT - explicitly pushes current HEAD to fork's main
335
+ git push fork HEAD:main
336
+ ```
337
+
338
+ **Full pattern for syncing a fork:**
339
+
340
+ ```bash
341
+ # In a worktree where origin=upstream, fork=your-fork
342
+ git fetch origin
343
+ git merge --ff-only origin/main # Update local main from upstream
344
+ git push fork HEAD:main # Explicitly push to fork
345
+ ```
346
+
347
+ **Rule:** When pushing to a non-tracking remote, always use explicit refspec
348
+ (`HEAD:<branch>` or `<local-branch>:<remote-branch>`) to avoid silent no-ops.
349
+
350
+ ## Submodules
351
+
352
+ ### Adding Submodules
353
+
354
+ ```bash
355
+ # Add submodule
356
+ git submodule add https://github.com/org/repo.git libs/repo
357
+
358
+ # Add at specific branch
359
+ git submodule add -b main https://github.com/org/repo.git libs/repo
360
+
361
+ # Initialize submodules after clone
362
+ git submodule init
363
+ git submodule update
364
+
365
+ # Clone with submodules
366
+ git clone --recurse-submodules https://github.com/org/main-repo.git
367
+ ```
368
+
369
+ ### Updating Submodules
370
+
371
+ ```bash
372
+ # Update all submodules to latest
373
+ git submodule update --remote
374
+
375
+ # Update specific submodule
376
+ git submodule update --remote libs/repo
377
+
378
+ # Update and merge
379
+ git submodule update --remote --merge
380
+
381
+ # Pull in main repo and submodules
382
+ git pull --recurse-submodules
383
+ ```
384
+
385
+ ### Submodule Commands
386
+
387
+ ```bash
388
+ # Run command in all submodules
389
+ git submodule foreach 'git pull origin main'
390
+
391
+ # Check status
392
+ git submodule status
393
+
394
+ # Remove submodule
395
+ git submodule deinit libs/repo
396
+ git rm libs/repo
397
+ rm -rf .git/modules/libs/repo
398
+ ```
399
+
400
+ ## Git Hooks
401
+
402
+ ### Client-Side Hooks
403
+
404
+ ```bash
405
+ # .git/hooks/pre-commit
406
+ #!/bin/bash
407
+ npm run lint
408
+ npm run test
409
+
410
+ # .git/hooks/commit-msg
411
+ #!/bin/bash
412
+ # Validate commit message format
413
+
414
+ # .git/hooks/pre-push
415
+ #!/bin/bash
416
+ npm run test:e2e
417
+ ```
418
+
419
+ ### Server-Side Hooks
420
+
421
+ ```bash
422
+ # hooks/pre-receive
423
+ #!/bin/bash
424
+ # Validate pushes before accepting
425
+
426
+ # hooks/post-receive
427
+ #!/bin/bash
428
+ # Deploy after push accepted
429
+
430
+ # hooks/update
431
+ #!/bin/bash
432
+ # Per-branch validation
433
+ ```
434
+
435
+ ### Hook Management with Husky
436
+
437
+ ```json
438
+ // package.json
439
+ {
440
+ "husky": {
441
+ "hooks": {
442
+ "pre-commit": "lint-staged",
443
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
444
+ "pre-push": "npm test"
445
+ }
446
+ },
447
+ "lint-staged": {
448
+ "*.{js,ts}": ["eslint --fix", "prettier --write"]
449
+ }
450
+ }
451
+ ```
452
+
453
+ ## Advanced Merging
454
+
455
+ ### Merge Strategies
456
+
457
+ ```bash
458
+ # Recursive (default)
459
+ git merge feature
460
+
461
+ # Ours (keep our changes)
462
+ git merge -s ours feature
463
+
464
+ # Subtree (merge into subdirectory)
465
+ git merge -s subtree --allow-unrelated-histories other-repo/main
466
+
467
+ # Octopus (merge multiple branches)
468
+ git merge feature1 feature2 feature3
469
+ ```
470
+
471
+ ### Merge Options
472
+
473
+ ```bash
474
+ # No fast-forward
475
+ git merge --no-ff feature
476
+
477
+ # Squash merge
478
+ git merge --squash feature
479
+
480
+ # Merge with message
481
+ git merge -m "Merge feature X" feature
482
+
483
+ # Abort merge
484
+ git merge --abort
485
+ ```
486
+
487
+ ### Rerere (Reuse Recorded Resolution)
488
+
489
+ ```bash
490
+ # Enable rerere
491
+ git config rerere.enabled true
492
+
493
+ # After resolving conflict, it's recorded
494
+ # Next time same conflict occurs, auto-resolved
495
+
496
+ # View recorded resolutions
497
+ git rerere status
498
+
499
+ # Forget resolution
500
+ git rerere forget path/to/file
501
+ ```
502
+
503
+ ## Git Attributes
504
+
505
+ ### Line Endings
506
+
507
+ ```bash
508
+ # .gitattributes
509
+ * text=auto
510
+ *.sh text eol=lf
511
+ *.bat text eol=crlf
512
+ *.png binary
513
+ ```
514
+
515
+ ### Diff and Merge
516
+
517
+ ```bash
518
+ # .gitattributes
519
+ *.min.js binary
520
+ *.lock -diff
521
+ *.pdf diff=pdf
522
+
523
+ # Custom diff driver
524
+ [diff "pdf"]
525
+ textconv = pdftotext -layout
526
+ ```
527
+
528
+ ### Export Ignore
529
+
530
+ ```bash
531
+ # .gitattributes
532
+ .gitignore export-ignore
533
+ .github export-ignore
534
+ tests/ export-ignore
535
+ ```
536
+
537
+ ## Performance Optimization
538
+
539
+ ### Large Repositories
540
+
541
+ ```bash
542
+ # Shallow clone
543
+ git clone --depth 1 https://github.com/org/repo.git
544
+
545
+ # Sparse checkout
546
+ git clone --filter=blob:none --sparse https://github.com/org/repo.git
547
+ cd repo
548
+ git sparse-checkout set src/
549
+
550
+ # Partial clone
551
+ git clone --filter=blob:none https://github.com/org/repo.git
552
+ ```
553
+
554
+ ### Git LFS
555
+
556
+ ```bash
557
+ # Install LFS
558
+ git lfs install
559
+
560
+ # Track large files
561
+ git lfs track "*.psd"
562
+ git lfs track "*.zip"
563
+
564
+ # View tracked patterns
565
+ git lfs track
566
+
567
+ # View LFS files
568
+ git lfs ls-files
569
+
570
+ # Pull LFS files
571
+ git lfs pull
572
+ ```
573
+
574
+ ### Repository Maintenance
575
+
576
+ ```bash
577
+ # Garbage collection
578
+ git gc
579
+
580
+ # Aggressive gc
581
+ git gc --aggressive
582
+
583
+ # Prune unreachable objects
584
+ git prune
585
+
586
+ # Verify repository
587
+ git fsck
588
+
589
+ # Repack
590
+ git repack -a -d
591
+ ```
592
+
593
+ ## Troubleshooting
594
+
595
+ ### Common Issues
596
+
597
+ ```bash
598
+ # Fix "detached HEAD"
599
+ git checkout -b new-branch # If you want to keep changes
600
+ git checkout main # If you want to discard
601
+
602
+ # Fix "refusing to merge unrelated histories"
603
+ git merge --allow-unrelated-histories other-branch
604
+
605
+ # Fix corrupted repository
606
+ git fsck --full
607
+ git gc --prune=now
608
+
609
+ # Remove file from all history
610
+ git filter-branch --force --index-filter \
611
+ 'git rm --cached --ignore-unmatch path/to/file' \
612
+ --prune-empty --tag-name-filter cat -- --all
613
+ ```
614
+
615
+ ### Recovery Operations
616
+
617
+ ```bash
618
+ # Recover deleted branch
619
+ git reflog
620
+ git checkout -b recovered abc1234
621
+
622
+ # Recover deleted file
623
+ git checkout HEAD~1 -- path/to/file
624
+
625
+ # Undo hard reset
626
+ git reflog
627
+ git reset --hard HEAD@{1}
628
+
629
+ # Recover stash
630
+ git fsck --unreachable | grep commit | cut -d' ' -f3 | \
631
+ xargs git log --merges --no-walk --grep=WIP
632
+ ```