Transcription of Git Cheat Sheet
{{id}} {{{paragraph}}}
Git Cheat SheetCreateFrom existing repoFrom existing datacd ~/projects/myprojectgit initgit add . git clone ~/existing/repo ~/new/repogit clone clone git command --helpGlobal Git configuration is stored in $HOME/.gitconfig (git config --help) Files changed in working directoryShowA specific file from a specific $IDChanges to tracked filesgit statusgit diff git show $id:$fileAll local branchesgit branchHistory of changesgit log Who changed what and when in a filegit blame $file What changed between $ID1 and $ID2git diff $id1 $id2 History of changes for file with diffsgit log -p $file $dir/ec/tory/A commit identified by $IDgit show $idRevertRevert the last commitgit revert HEAD Revert specific commitgit revert $id Checkout the $id version of a filegit checkout $id $file!
! you cannot undo a hard reset Return to the last committed state git reset --hard Fix the last commit git commit -a --amend (after editing the broken files) Creates a new commit Creates a new commit Branch Merge branch1 into branch2 ... HEAD~4 : the great-great grandparent of HEAD.
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}