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
git:crib [2019/10/03 18:28]
admin [Discard all local changes]
git:crib [2020/02/28 10:04] (current)
admin [Settings]
Line 1: Line 1:
 ====== git cribsheet ====== ====== git cribsheet ======
-https://​mirrors.edge.kernel.org/​pub/​software/​scm/​git/​docs/​user-manual.html#​git-concepts 
- 
 ===== Undo ===== ===== Undo =====
 ==== Unstage file ==== ==== Unstage file ====
Line 22: Line 20:
  
  
-===== Get existing remote branch ​=====+===== Branches ===== 
 +==== Get existing remote branch ====
  
 https://​stackoverflow.com/​questions/​9537392/​git-fetch-remote-branch https://​stackoverflow.com/​questions/​9537392/​git-fetch-remote-branch
   * ''​git checkout %%--%%track origin/​remote_branch_name''​   * ''​git checkout %%--%%track origin/​remote_branch_name''​
  
 +==== Branch deletion ====
 +
 +=== Local branches ===
 +  ** ''​git branch -d <​branch_name>''​
 +  .. ''​-D''​ to force deletion in the presence of local-only changes
 +
 +=== Remote branches ===
 +https://​stackoverflow.com/​questions/​2003505/​how-do-i-delete-a-git-branch-locally-and-remotely
 +  ** ''​git push -d origin <​branch>''​
 +  .. (Substitute ''​origin''​ for a different remote name if required).
 +=== Obsolete tracking branches ===
 +https://​stackoverflow.com/​questions/​7726949/​remove-tracking-branches-no-longer-on-remote
 +  * ''​git remote prune origin''​
 ===== List conflicted files ===== ===== List conflicted files =====
   * ''​git diff %%--%%name-only %%--%%diff-filter=U''​   * ''​git diff %%--%%name-only %%--%%diff-filter=U''​
Line 50: Line 62:
 https://​www.atlassian.com/​git/​tutorials/​setting-up-a-repository/​git-config covers a lot of possible settings. https://​www.atlassian.com/​git/​tutorials/​setting-up-a-repository/​git-config covers a lot of possible settings.
 === Editor === === Editor ===
-By default the mighty [[https://​www.vim.org/​|vim]]. If that's not your cup of tea:+In Git for Windows, by default the mighty [[https://​www.vim.org/​|vim]]. If that's not your cup of tea:
   * ''​git config %%--%%global core.editor %%"​%%'​C:/​Program Files/​Notepad++/​notepad++.exe'​ -multiInst -notabbar -nosession -noPlugin%%"​%%''​   * ''​git config %%--%%global core.editor %%"​%%'​C:/​Program Files/​Notepad++/​notepad++.exe'​ -multiInst -notabbar -nosession -noPlugin%%"​%%''​
  
Line 80: Line 92:
   .. This is ill-advised as it [[https://​stackoverflow.com/​questions/​23885449/​unable-to-resolve-unable-to-get-local-issuer-certificate-using-git-on-windows/​38460722|opens you up to man-in-the-middle attacks]].   .. This is ill-advised as it [[https://​stackoverflow.com/​questions/​23885449/​unable-to-resolve-unable-to-get-local-issuer-certificate-using-git-on-windows/​38460722|opens you up to man-in-the-middle attacks]].
  
 +===== Useful links =====
 +
 +  * https://​mirrors.edge.kernel.org/​pub/​software/​scm/​git/​docs/​user-manual.html#​git-concepts
 +  * http://​git-school.github.io/​visualizing-git/​
    
 {{tag> git}} {{tag> git}}