Sistema de controle de versão Distribuído
Centralizado
Distribuído
Por que Git?
Source: RebelLabs 2013
SVN salva as diferenças entre arquivos
Git salva o snapshop da situação de cada arquivo
Source: Pro git
Source: Greenido
Source: Atlassian
git help
git init
git config
git config --global user.name "yourName"
git config --global user.email "yourMail"
git config --list
git status
git add "yourname.txt"
git status -v
git commit -m "added initial file"
git status
git status
git commit -a -m "Modified file"
git log
git add *.txt
git status
git reset HEAD
git status
git status
git checkout -- "filename"
git status
- reset HEAD~: Returns the staging area to last commit but does not modify the files.
- reset --soft HEAD~:Undoes the commit but does not modify the files.
- reset --hard HEAD~: Undoes the commit and modifies the files to last commit.
git log --oneline --decorate
git reset --soft HEAD~
git log --oneline --decorate
git status
git commit --amend -m "modified initial and added second"
git status
git log --oneline -p
Switching of timelines
git branch develop
git branch
git checkout develop
git branch
git log --decorate
git checkout master
git log --decorate
git merge develop
git log --decorate
git checkout -b featureX
git merge featureX
git log --graph --oneline --decorate --all
git merge featureX
git add -all
git commit
git branch -d featureX
git branch
git log --decorate
Source: Atlassian
Rebase is another way of merging. What it does is :
git rebase featureXX
git log --graph --oneline --decorate --all
git branch -d featureXX
A central repository where different developers can upload and download their commits from their local repository.
git remote add origin URL
git remote -v
git push -u origin develop
git clone https://github.com/bgorriz/git-workshop.git
git remote -v
git remote show origin
git log --oneline --decorate
git pull
git log --decorate
git pull
git log
You may need other people to work on a feature.
You may want different timelines with certain commits on remote.
git push -u origin master
git push
git branch
git pull
git checkout -b master origin/master
git remote show origin
git push origin:branchName
git branch -d branchName
Git has two ways of tagging:
git tag -a v0.0.1 -m "version 0.0.1"
git tag
git push origin --tags
git checkout v0.0.1
git tag -s v0.0.1 -m "tag message"
git tag -v "tagname"
You will need the signer public key.Store some file in a temporary area.
git diff
git status
git stash save
git diff
git status
git stash list
git stash apply
git diff
git stash list
git stash drop
git stash list
Git keeps track of updates to the tip of branches using a mechanism called reflog. This allows you to go back to changesets even though they are not referenced by any branch or tag.
Source: cambrico
git reset --hard HEAD~
git log
git reflog
git reset --hard "sha"
git branch -D "branchname"
git log
git reflog
git branch "branchname" "sha"
git checkout "branchname"
git log
git rm --chaced filename
Source: K:\ENGINYERIA SOFTWARE\PUBLIC
git flow init
git branch
git@github.com:bgorriz/gitflowTest.git
git config push.default current
git flow init
git push -u origin develop
git remote
git clone git@github.com:bgorriz/gitflowTest.git
git flow feature
git config push.default current
git flow init -d
git remote show origin
git flow feature start "convention"
git branch
git log --oneline
git flow feature publish "covention"
git flow feature track "convention"
git remote show origin
git log --oneline
git pull --rebase
git flow feature finish -F "convention"
git branch
git log
git push
git checkout develop
git branch -d feature/"convention"
git pull --rebase
git branch
git log
git flow release start rc-1.0.0_20140121
git branch
git flow release finish rc-1.0.0_20140122
git push
git push --tags
git status
git pull --rebase
git push
git log
git flow hotfix start hotfix-002_20140122
git branch
git flow hotfix finish hotfix-002_20140122
git branch
git pull --tags