Git Cheat Sheet
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 $id2History 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 resetReturn to the last committed stategit reset --hardFix the last commitgit commit -a --amend (after editing the broken files)Creates a new commitCreates a new commitBranchMerge branch1 into branch2git checkout $branch2git merge branch1Create branch named $branch based on the HEADgit branch $branchSwitch to the $id branchgit checkout $idCreate branch $new_branch based on branch $other and switch to itgit checkout -b $new_branch $otherDelete branch $branchgit branch -d $branchCommit all your local changesPublishgit commit -aPrepare a patch for other developersgit format-patch origingit pushPush changes
Git Cheat Sheet Create From existing repo From existing data cd ~/projects/myproject git init git add . git clone ~/existing/repo ~/new/repo git clone git://host.org ...
Download Git Cheat Sheet
Information
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document: