linux_wiki:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:git [2019/07/13 19:57]
billdozor [Clone Repos]
linux_wiki:git [2020/01/10 18:29] (current)
billdozor [Extra Characters in git diff]
Line 78: Line 78:
 git config --global credential.helper 'cache --timeout=3600' git config --global credential.helper 'cache --timeout=3600'
 </code> </code>
 +
 +\\
 +Disable https verify for self signed certs on a single cloned repo<code bash>git config http.sslVerify false</code>
 +
 +\\
 +Alternatively, configure git to trust self signed certs: https://stackoverflow.com/questions/9072376/configure-git-to-accept-a-particular-self-signed-server-certificate-for-a-partic
  
 ---- ----
Line 90: Line 96:
 \\ \\
 Download an existing project via HTTPS URL and do not verify ssl cert for self signed<code bash>git -c http.sslVerify=false clone https://URL</code> Download an existing project via HTTPS URL and do not verify ssl cert for self signed<code bash>git -c http.sslVerify=false clone https://URL</code>
- 
----- 
- 
-====== Configure Repos ====== 
- 
-Disable https verify for self signed certs on a single cloned repo<code bash>git config http.sslVerify false</code> 
- 
-\\ 
-Alternatively, configure git to trust self signed certs: https://stackoverflow.com/questions/9072376/configure-git-to-accept-a-particular-self-signed-server-certificate-for-a-partic 
  
 ---- ----
Line 137: Line 134:
       * View recent commits with diff details<code bash>git log -p</code>       * View recent commits with diff details<code bash>git log -p</code>
       * Retrieve the commit SHA hash from the above and revert that push<code bash>git revert <SHA></code>       * Retrieve the commit SHA hash from the above and revert that push<code bash>git revert <SHA></code>
 +
 +----
 +
 +====== Exclude Files from Tracking ======
 +
 +A plain text file called '.gitignore' in the project root excludes files and directories from tracking by git.
 +
 +Full documentation here: https://git-scm.com/docs/gitignore
 +
 +\\
 +Example .gitignore<code bash># Git ignore file - comments are allowed
 +__pycache__/
 +*.log
 +tmp/</code>
 +  * Do not track any files that
 +    * Are inside a __pycache__ directory
 +    * End in .log
 +    * Are inside a tmp directory
 +
 +\\
 +List all ignored files in the current project<code bash>git ls-files --other --ignored --exclude-standard</code>
  
 ---- ----
Line 282: Line 300:
 ===== Deleting Branches ===== ===== Deleting Branches =====
  
 +Delete a remote branch<code bash>git push origin --delete <branch-name></code>
 +
 +\\
 Delete a local branch<code bash>git branch --delete <branch-name></code> Delete a local branch<code bash>git branch --delete <branch-name></code>
 +
 +\\
 +Prune remote list if remote branches were deleted by someone else<code bash>git remote prune origin</code>
  
 ---- ----
Line 312: Line 336:
  
   * Push local changes to your fork on github<code bash>git push origin master</code>   * Push local changes to your fork on github<code bash>git push origin master</code>
 +
 +----
 +
 +====== Troubleshooting ======
 +
 +Fixing different git issues.
 +
 +===== Extra Characters in git diff =====
 +
 +* Fix/remove 'ESC[xxx' characters in git diff<code bash>git config --global core.pager "less -R"</code>
 +\\
 +
 +* Fix/remove '^M' characters in git diff<code bash>git config --global core.pager "tr -d '\r' | less -REX"</code>
  
 ---- ----
  
  • linux_wiki/git.1563062221.txt.gz
  • Last modified: 2019/07/13 19:57
  • by billdozor