Download - Git-podstawy
gitPodstawy
Tymon TobolskiKoło Naukowe iLabs
Politechnika Wrocławska
wtorek, 11 maja 2010
Dlaczego git?
wtorek, 11 maja 2010
wtorek, 11 maja 2010
Instalacja
wtorek, 11 maja 2010
albo...
$ sudo port install git-core
wtorek, 11 maja 2010
Konfiguracja
~ $ git config --global user.name ”Tymon Tobolski”~ $ git config --global user.email ”[email protected]”
wtorek, 11 maja 2010
Konfiguracja
~ $ git config --global user.name ”Tymon Tobolski”~ $ git config --global user.email ”[email protected]”
~ $ cat .gitconfig[user]! name = Tymon Tobolski! email = [email protected]
wtorek, 11 maja 2010
Komendyaddam
annotateapply
applymboxapplypatcharchimport
archivebisectblamebranchcat-file
check-attrcheck-ref-format
checkoutcheckout-index
cherrycherry-pick
clean
clone clone-pack
commitcommit-tree
configconvert-objectscount-objects
cvsexportcommitcvsimportdescribe
diffdiff-files
diff-indexdiff-stagesdiff-tree
fetchfetch-packfor-each-refformat-patch
fsckgc
get-tar-commit-idgrep
hash-objectimap-sendindex-pack
initinstaweb
local-fetchlog
lost-foundls-files
ls-remotels-treemailinfomailsplitmerge
merge-base
merge-filemerge-indexmerge-tree mergetool
mktagmktree
mvname-rev
pack-objectspack-redundant
pack-refsparse-remote
patch-idpeek-remote
pruneprune-packed
pullpush
quiltimportread-tree
rebasereflogrelink
remoterepack
request-pullrererereset
rev-listrevert
rmsend-emailshortlog
showshow-branchshow-index
show-refstashstatussvn
svnimportsymbolic-ref
tag tar-tree
unpack-fileunpack-objectsupdate-indexupdate-ref
update-server-infovar
verify-packverify-tag
whatchangedwrite-tree
wtorek, 11 maja 2010
Komendyaddam
annotateapply
applymboxapplypatcharchimport
archivebisectblamebranchcat-file
check-attrcheck-ref-format
checkoutcheckout-index
cherrycherry-pick
clean
clone clone-pack
commitcommit-tree
configconvert-objectscount-objects
cvsexportcommitcvsimportdescribe
diffdiff-files
diff-indexdiff-stagesdiff-tree
fetchfetch-packfor-each-refformat-patch
fsckgc
get-tar-commit-idgrep
hash-objectimap-sendindex-pack
initinstaweb
local-fetchlog
lost-foundls-files
ls-remotels-treemailinfomailsplitmerge
merge-base
merge-filemerge-indexmerge-tree mergetool
mktagmktree
mvname-rev
pack-objectspack-redundant
pack-refsparse-remote
patch-idpeek-remote
pruneprune-packed
pullpush
quiltimportread-tree
rebasereflogrelink
remoterepack
request-pullrererereset
rev-listrevert
rmsend-emailshortlog
showshow-branchshow-index
show-refstashstatussvn
svnimportsymbolic-ref
tag tar-tree
unpack-fileunpack-objectsupdate-indexupdate-ref
update-server-infovar
verify-packverify-tag
whatchangedwrite-tree
wtorek, 11 maja 2010
git init
~ $ mkdir ilabs~ $ cd ilabs
wtorek, 11 maja 2010
git init
~ $ mkdir ilabs~ $ cd ilabs~/ilabs $ git initInitialized empty Git repository in /Users/teamon/ilabs/.git/
wtorek, 11 maja 2010
git init
~/ilabs $ ls -latotal 0drwxr-xr-x 3 teamon staff 102 2 maj 15:02 ./drwxr-xr-x+ 72 teamon staff 2448 2 maj 15:02 ../drwxr-xr-x 11 teamon staff 374 2 maj 15:05 .git/
Nie ma folderow .svn !
wtorek, 11 maja 2010
Katalog roboczy
Staging area
Repozytorium
git add
git commit
edycja
wtorek, 11 maja 2010
git status
~/ilabs $ git status# On branch master## Initial commit#nothing to commit (create/copy files and use "git add" to track)
wtorek, 11 maja 2010
git status
~/ilabs $ echo "KN iLabs" > README
wtorek, 11 maja 2010
git status
~/ilabs $ echo "KN iLabs" > README~/ilabs $ git status# On branch master## Initial commit## Untracked files:# (use "git add <file>..." to include in what will be committed)##! READMEnothing added to commit but untracked files present (use "git add" to track)
wtorek, 11 maja 2010
git add
~/ilabs $ git add README
wtorek, 11 maja 2010
git add
~/ilabs $ git add README~/ilabs $ git status# On branch master## Initial commit## Changes to be committed:# (use "git rm --cached <file>..." to unstage)##! new file: README#
wtorek, 11 maja 2010
git commit
~/ilabs $ git commit -m "First commit"[master (root-commit) 28dc8e9] First commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README
wtorek, 11 maja 2010
git commit
~/ilabs $ git commit -m "First commit"[master (root-commit) 28dc8e9] First commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README
~/ilabs $ git status# On branch masternothing to commit (working directory clean)
wtorek, 11 maja 2010
git log
~/ilabs $ git logcommit 28dc8e941ac55657cc633575967a7e72dd3ea898Author: Tymon Tobolski <[email protected]>Date: Sun May 2 15:23:58 2010 +0200
First commit
wtorek, 11 maja 2010
git log~/ilabs $ git logcommit 66c61ef16075eccbfd4f015e3e12c6c5f87c29d0Author: Tymon Tobolski <[email protected]>Date: Sun May 2 15:51:53 2010 +0200
Next one
commit 595ae522a0b115535f166813e31538b4f7119013Author: Tymon Tobolski <[email protected]>Date: Sun May 2 15:51:40 2010 +0200
Second commit
commit 28dc8e941ac55657cc633575967a7e72dd3ea898Author: Tymon Tobolski <[email protected]>Date: Sun May 2 15:23:58 2010 +0200
First commit
wtorek, 11 maja 2010
Workflow
c1
c2
c3
MESSAGE: First commit SHA: 28dc8e941ac55657cc633575967a7e72dd3ea898
MESSAGE: Second commit SHA: 595ae522a0b115535f166813e31538b4f7119013 PARENT: 28dc8e941ac55657cc633575967a7e72dd3ea898
MESSAGE: Next one SHA: 66c61ef16075eccbfd4f015e3e12c6c5f87c29d0 PARENT: 595ae522a0b115535f166813e31538b4f7119013
wtorek, 11 maja 2010
git branch
wtorek, 11 maja 2010
git branch
c1 c2 c3 c4 master
c6 featurec5
wtorek, 11 maja 2010
git branch / checkout~/ilabs $ git branch feature
wtorek, 11 maja 2010
git branch / checkout~/ilabs $ git branch feature
~/ilabs $ git branch feature* master
wtorek, 11 maja 2010
git branch / checkout~/ilabs $ git branch feature
~/ilabs $ git branch feature* master
~/ilabs $ git checkout featureSwitched to branch 'feature'
wtorek, 11 maja 2010
git branch / checkout~/ilabs $ git branch feature
~/ilabs $ git branch feature* master
~/ilabs $ git checkout featureSwitched to branch 'feature'
~/ilabs $ git branch* feature master
wtorek, 11 maja 2010
git branch / checkout
git branch featuregit checkout feature
==
git checkout -b feature
wtorek, 11 maja 2010
git merge
wtorek, 11 maja 2010
git merge
wtorek, 11 maja 2010
git merge
c3 c4master
c6feature c5
...
...
c7 master
wtorek, 11 maja 2010
git merge
c4 c6
c7
SHA: 81f23...b9942 SHA: 9dc8d...d497f
SHA: 8f06c...20e83
wtorek, 11 maja 2010
git merge
c4 c6
c7
SHA: 81f23...b9942 SHA: 9dc8d...d497f
SHA: 8f06c...20e83PARENT: 81f23...b9942
wtorek, 11 maja 2010
git merge
c4 c6
c7
SHA: 81f23...b9942 SHA: 9dc8d...d497f
SHA: 8f06c...20e83PARENT: 81f23...b9942PARENT: 9dc8d...d497f
wtorek, 11 maja 2010
git merge
~/ilabs $ git checkout masterSwitched to branch 'master'
wtorek, 11 maja 2010
git merge
~/ilabs $ git checkout masterSwitched to branch 'master'
~/ilabs $ git merge featureMerge made by recursive.1 files changed, 1 insertions(+), 0 deletions(-)
wtorek, 11 maja 2010
git stash~/ilabs $ git stashSwitched to branch 'master'
wtorek, 11 maja 2010
git stash~/ilabs $ git stashSwitched to branch 'master'
~/ilabs $ echo "666" >> README
wtorek, 11 maja 2010
git stash~/ilabs $ git stashSwitched to branch 'master'
~/ilabs $ echo "666" >> README
~/ilabs $ git status# On branch master# Changed but not updated:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)##! modified: README#no changes added to commit (use "git add" and/or "git commit -a")
wtorek, 11 maja 2010
git stash~/ilabs $ cat READMEasd666
wtorek, 11 maja 2010
git stash~/ilabs $ cat READMEasd666
~/ilabs $ git stashSaved working directory and index state WIP on master: 992f518 Merge branch 'foo'HEAD is now at 992f518 Merge branch 'foo'
wtorek, 11 maja 2010
git stash~/ilabs $ cat READMEasd666
~/ilabs $ git stashSaved working directory and index state WIP on master: 992f518 Merge branch 'foo'HEAD is now at 992f518 Merge branch 'foo'
~/ilabs $ git status# On branch masternothing to commit (working directory clean)
wtorek, 11 maja 2010
git stash~/ilabs $ cat READMEasd666
~/ilabs $ git stashSaved working directory and index state WIP on master: 992f518 Merge branch 'foo'HEAD is now at 992f518 Merge branch 'foo'
~/ilabs $ git status# On branch masternothing to commit (working directory clean)
~/ilabs $ cat READMEasd
wtorek, 11 maja 2010
git stash~/ilabs $ git stash apply# On branch master# Changed but not updated:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)##! modified: README#no changes added to commit (use "git add" and/or "git commit -a")
wtorek, 11 maja 2010
git stash~/ilabs $ git stash apply# On branch master# Changed but not updated:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)##! modified: README#no changes added to commit (use "git add" and/or "git commit -a")
~/ilabs $ cat README asd666
wtorek, 11 maja 2010
Remote
wtorek, 11 maja 2010
github
wtorek, 11 maja 2010
github
wtorek, 11 maja 2010
git clone~ $ git clone [email protected]:teamon/synergio.git
wtorek, 11 maja 2010
git clone~ $ git clone [email protected]:teamon/synergio.gitInitialized empty Git repository in /Users/teamon/Desktop/synergio/.git/remote: Counting objects: 140, done.remote: Compressing objects: 100% (129/129), done.remote: Total 140 (delta 64), reused 0 (delta 0)Receiving objects: 100% (140/140), 159.13 KiB | 99 KiB/s, done.Resolving deltas: 100% (64/64), done.
wtorek, 11 maja 2010
git remote~ $ cd synergio~/synergio $ git remoteorigin
wtorek, 11 maja 2010
git remote~ $ cd synergio~/synergio $ git remoteorigin
~/synergio $ git remote show origin* remote origin Fetch URL: [email protected]:teamon/synergio.git Push URL: [email protected]:teamon/synergio.git HEAD branch: master Remote branch: master tracked Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (fast forwardable)
wtorek, 11 maja 2010
git push
~/synergio $ git push origin masterCounting objects: 5, done.Delta compression using up to 2 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 287 bytes, done.Total 3 (delta 2), reused 0 (delta 0)To [email protected]:teamon/synergio.git 4826a55..fd8157e master -> master
wtorek, 11 maja 2010
git pull
~/synergio $ git pull origin masterFrom github.com:teamon/synergio * branch master -> FETCH_HEADRemoving resources/app_j.jsMerge made by recursive. resources/app_j.js | 201 ---------------------------------------------------- 1 files changed, 0 insertions(+), 201 deletions(-) delete mode 100644 resources/app_j.js
wtorek, 11 maja 2010
GitX
wtorek, 11 maja 2010
GitX
• http://gitx.frim.nl - wersja stabilna
• http://brotherbard.com/blog/2010/03/experimental-gitx-fork/
wtorek, 11 maja 2010
Prezentacja do pobrania
http://s.teamon.eu/Git.pdf
wtorek, 11 maja 2010