Git cheat sheet

Disponível somente no TrabalhosFeitos
  • Páginas : 3 (599 palavras )
  • Download(s) : 0
  • Publicado : 9 de abril de 2013
Ler documento completo
Amostra do texto
itGit Cheat Sheet
Remember: git command --help Global Git configuration is stored in $HOME/.gitconfig (git config --help)

Commands Sequence
the curves indicate that thecommand on the right is usually executed after the command on the left. This gives an idea of the flow of commands someone usually does with Git.






BRANCHinit clone

From existing data

Concepts Git Basics
master origin HEAD HEAD^ HEAD~4 : default development branch : default upstream repository : current branch : parent of HEAD : thegreat-great grandparent of HEAD

status log show diff branch

reset checkout revert

pull fetch merge am

checkout branch





cd~/projects/myproject git init git add .
From existing repo

git clone ~/existing/repo ~/new/repo git clone git:// git clone ssh://

Files changed in workingdirectory

git reset --hard
Return to the last committed state

you cannot undo a hard reset

git status git diff

Revert the last commit

Fetch latest changes from originPublish
Commit all your local changes

Changes to tracked files What changed between $ID1 and $ID2

git revert HEAD

Creates a new commit

Revert specific commit

git fetch

(but thisdoes not merge them).

git commit -a
Prepare a patch for other developers

git revert $id
Fix the last commit

Creates a new commit

Pull latest changes from origin

git diff $id1 $id2 gitlog

git pull

History of changes History of changes for file with diffs

git commit -a --amend

(does a fetch followed by a merge)

git format-patch origin git push

(after editing thebroken files)

Apply a patch that some sent you

Push changes to origin

Checkout the $id version of a file

git am -3 patch.mbox

git log -p $file $dir/ec/tory/ git blame $file git show $id...
tracking img