Difference between revisions of "Git command summary"

From Jens' Hjørne
Jump to navigation Jump to search
m
m
Line 9: Line 9:
 
===Switch branch===
 
===Switch branch===
 
  '''git checkout''' ''branch-name''
 
  '''git checkout''' ''branch-name''
 +
 +
==Staging==
 +
'''git add''' ''file-name''
  
 
==Committing==
 
==Committing==
Line 16: Line 19:
 
===Push===
 
===Push===
 
  '''git push'''
 
  '''git push'''
 +
 +
==Diffing==
 +
===Diff===
 +
To see a diff list of changes made to the files on disk:
 +
'''git diff'''
 +
 +
To see a diff list of changes made to the staged files:
 +
'''git diff --cached'''
  
 
[[Category:Værktøjer, Programmering]][[Category:Keyboard shortcuts]]
 
[[Category:Værktøjer, Programmering]][[Category:Keyboard shortcuts]]

Revision as of 13:05, 16 February 2017

Branching

Create branch

git branch branch-name

Display branches

git branch

Switch branch

git checkout branch-name

Staging

git add file-name

Committing

Commit

git commit -m "Commit message goes here."

Push

git push

Diffing

Diff

To see a diff list of changes made to the files on disk:

git diff

To see a diff list of changes made to the staged files:

git diff --cached