1+ # CheetSheet
2+
13& "C:\Program Files (x86)\Info Keep\info keep.exe"
24
3- Photography Co-worker Kevin Hecht ( kevin.a.hecht@pwc.com )
5+ Photography Co-worker [ Kevin Hecht] ( mailto:// kevin.a.hecht@pwc.com)
46
5- # To Publish Module to PowerShell Gallery
7+ ## To Publish Module to PowerShell Gallery
68
9+ ``` powershell
710Publish-Module -Path <Path> -NuGetApiKey <APIKey> -Repository PSGallery
811
912Publish-Module -Path "C:\Git\SqlQueryClass\dist\SqlQueryClass" -NuGetApiKey "" -Repository PSGallery
@@ -40,42 +43,45 @@ AdditionalMetadata : @{summary=Module that create an instance of a Power
4043 isLatestVersion=True; CompanyName=Unknown; Functions=New-SqlQueryDataSet; FileList=SqlQueryClass.nuspec|about_SqlQueryClass.help.txt|SqlQueryClass.psd1|SqlQueryClass.psm1;
4144 PowerShellHostVersion=5.1; created=2/6/2025 3:43:39 AM -05:00; isAbsoluteLatestVersion=True; copyright=(c) Brooks Vaughn. All rights reserved.; packageSize=15464; developmentDependency=False;
4245 updated=2025-02-06T03:43:39Z; published=2/6/2025 3:43:39 AM -05:00}
46+ ```
4347
44-
45-
46- # Code Signing
48+ ## Code Signing
4749
4850Get-ChildItem -Path Cert:\CurrentUser -Recurse | FL
4951Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert
5052Get-ChildItem -Path Cert:\LocalMachine -Recurse | FL
5153
52- # git config commands
54+ ## git config commands
5355
5456- ps.readinglist.md -- Quick Reference Reading list of helpful PowerShell sites, articles, and documents
5557
5658### Support for Long Paths
5759
5860git config --system core.longpaths true
5961
60- ### git remote urls
62+ #### git remote urls
6163
6264git remote -v
6365
6466## User Config
6567
6668### To Set your username
6769
70+ ``` powershell
6871git config --global user.name "FIRST_NAME LAST_NAME"
72+ ```
6973
7074### To Set your email address
7175
76+ ``` powershell
7277git config --global user.email "MY_NAME@example.com"
7378
7479git config --global user.name "Brooks Vaughn"
7580git config --global user.email "18422308+BrooksV@users.noreply.github.com"
7681
7782git config --worktree user.name "Brooks Vaughn"
7883git config --global user.email "18422308+BrooksV@users.noreply.github.com"
84+ ```
7985
8086### Check configuration for your user
8187
@@ -85,54 +91,71 @@ $ cat $HOME/.gitconfig
8591
8692### Get system value
8793
94+ ``` powershell
8895git config --system --get https.proxy
8996git config --system --get http.proxy
97+ ```
9098
9199### Get global value
92100
101+ ``` powershell
93102git config --global --get https.proxy
94103git config --global --get http.proxy
104+ ```
95105
96106### Unset system value
97107
98- $ git config --system --unset https.proxy
99- $ git config --system --unset http.proxy
108+ ``` powershell
109+ git config --system --unset https.proxy
110+ git config --system --unset http.proxy
111+ ```
100112
101113### Unset global value
102114
103- $ git config --global --unset https.proxy
104- $ git config --global --unset http.proxy
115+ ``` powershell
116+ git config --global --unset https.proxy
117+ git config --global --unset http.proxy
118+ ```
105119
106120## Proxy Config using Environment Variables
107121
108122Your proxy could also be set as an environment variable. Check if your environment has any of the env variables http_proxy or https_proxy set up and unset them. Examples of how to set up:
109123
110124### Linux
111125
126+ ``` bash
112127export http_proxy=http://proxy:8080
113128export https_proxy=https://proxy:8443
129+ ```
114130
115131### Windows
116132
133+ ``` powershell
117134set http_proxy http://proxy:8080
118135set https_proxy https://proxy:8443
136+ ```
119137
120138## SSL Config
121139
140+ ``` powershell
122141git config --global http.sslVerify
123142git config --global http.sslVerify true
143+ ```
124144
125145### Repro Clone SSL Errors
126146
147+ ``` powershell
127148SSL_VERIFY=false
128149git config --global http.sslVerify false
150+ ```
129151
130152My agents are running as Network Service too but that wasn't really a problem to use user level config. Here is what I did:
1311531.Save all the necessary certificates in folder %systemroot%\ServiceProfiles\NetworkService\. gitcerts\.
1321542.Create a file at %systemroot%\ServiceProfiles\NetworkService\. gitconfig with the following content:
133155
134156[ http "https://tfs.com/ "] ( http " https://tfs.com/ ")
135- sslCAInfo = ~ /.gitcerts/certificate.pem
157+
158+ $sslCAInfo = ~ /.gitcerts/certificate.pem
136159
137160[ adding-a-corporate-or-self-signed-certificate-authority-to-git-exes-store] ( https://blogs.msdn.microsoft.com/phkelley/2014/01/20/adding-a-corporate-or-self-signed-certificate-authority-to-git-exes-store/ )
138161
@@ -141,7 +164,7 @@ git config --global http.sslBackend schannel
141164[ how-to-make-git-work-with-self-signed-ssl-certificates-on-tfs2018] ( https://www.benday.com/2017/12/15/how-to-make-git-work-with-self-signed-ssl-certificates-on-tfs2018/ )
142165[ fix-git-self-signed-certificate-in-certificate-chain-on-windows] ( https://mattferderer.com/fix-git-self-signed-certificate-in-certificate-chain-on-windows )
143166
144- # Git Repo and Branch Commands
167+ ## Git Repo and Branch Commands
145168
146169### Reset Local Master
147170
@@ -158,22 +181,24 @@ git checkout main
158181git reset --hard origin/main
159182git pull origin main
160183
161- If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command.
184+ If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command.
162185
186+ ``` powershell
163187Example:
164188 git switch -c <new-branch-name>
165189
166190Or undo this operation with:
167- git switch -
191+ git switch -?
192+ ```
168193
169194## Status and Info Commands
170195
196+ ``` powershell
171197git status
172198git log
173199git branch --all
174200git branch features/<Branch name>
175201
176-
177202git fetch origin
178203git fetch origin master
179204git checkout master
@@ -184,76 +209,88 @@ git status
184209git log
185210git push
186211
187-
188212git pull
189213git branch -a
214+ ```
190215
191216## To Create Branch from Master
192217
218+ ``` powershell
193219git fetch origin master
194220git checkout master
195221git pull origin master
196222git checkout -b features/???
197223git push --set-upstream origin features/???
198224git checkout features/???
225+ ```
199226
200227### Create local branch
201228
229+ ``` powershell
202230git checkout -b features/<branch name>
203231git status
204232git add foo.txt
205233git commit -m "<comment>"
206- git commit -a -m "<comment >" # ?
234+ git commit -a -m "<comment>" ## ?
207235git push
236+ ```
208237
209238### Create Branch on origin (UpStream) to Repository
210239
240+ ``` powershell
211241git push --set-upstream origin features/<branch name>
242+ ```
212243
213244### To sync local master
214245
246+ ``` powershell
215247git checkout master
216248git pull
217249
218250git checkout features/readme-updates
219251git merge master ????
252+ ```
220253
221- # Notes
254+ ## Notes
222255
223256Origin is the plcae where the branch was cloned from
224257
258+ ``` powershell
225259git remote add <name> <url>
226260git add -p
227261git log --online
228262
229263npm config set strict-ssl false
264+ ```
230265
266+ ## Git Merging commands
231267
232- # Git Merging commands
233-
268+ ``` powershell
234269git merge branch master
235270git status
236271git log
237272git push
238273
239-
240274git config --get --local core.filemode
241275false
242276
243277git config --local --list
278+ ```
244279
245280## Commits
246281
282+ ``` powershell
247283git add yaml\???.yml
248284git commit -m "???"
249- git commit -a -m "<comment >" # ?
285+ git commit -a -m "<comment>" ## ?
250286git push
251287git merge --abort
252288git branch -a --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
253289(git reflog > reflog.md) | Invoke-Item
254290git reflog | Select-String <issue trackerID>
291+ ```
255292
256- ### Explanation of what each of those Git commands do
293+ ## Explanation of what each of those Git commands do
257294
258295### ` git add yaml???.yml `
259296
@@ -307,12 +344,14 @@ These commands cover a range of Git operations, from staging and committing chan
307344
308345## Git Command docs
309346
347+ ``` powershell
310348git remote add upstream
311349git fetch upstream
312350git rebase upstream/master
313351git push origin master --force
352+ ```
314353
315- ### Explanation of what each of those Git commands does:
354+ ## Explanation of what each of those Git commands does
316355
317356### ` git remote add upstream `
318357
@@ -358,8 +397,9 @@ git push origin master --force
358397- ** Purpose** : To overwrite the remote ` master ` branch with your local changes, even if it results in non-fast-forward updates.
359398- ** Example** : Use with caution as it can overwrite changes in the remote repository that others may be relying on.
360399
361- # 2025-02-05 22:59:55
400+ ## 2025-02-05 22:59:55
362401
402+ ``` powershell
363403git pull origin main
364404
365405git checkout -b features/readme-updates
@@ -369,4 +409,17 @@ git commit -m ""
369409
370410git commit -a -m "Updated SQL query class and added error handling"
371411
372- git push
412+ git push
413+ ```
414+
415+ ``` powershell
416+ ```
417+
418+ ``` powershell
419+ ```
420+
421+ ``` powershell
422+ ```
423+
424+ ``` powershell
425+ ```
0 commit comments