Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

GIT

No description
by

Vojtěch Erben

on 10 November 2015

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of GIT

Architektura GITu
Základní příkazy
Distribuovaný systém
Začleňování kódu a řešení konfliktů
Tipy, triky

Větve v GITu
Update restclient

- add short variants of app parameters
- add parameter --verbose, -v for verbose mode
- in verbose mode each request and response header are printed with content
- pretty printers for output
- automatically login when credentials are set
Commit
Komentáře jsou koncipovány jako e-maily
První řádek je předmět
Následuje prázdný řádek a tělo
Stav souboru
$ git add
$ git commit
$ git add
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: include/rest/Utility.h
modified: libs/rest/RESTObject.cpp
modified: src/server/objects/admin/AdminUser.cpp
modified: src/server/objects/kws/KeywordSpottingList.cpp
modified: src/server/objects/sid/SpeakerIdentificationGroupSpkModel.cpp
modified: src/server/objects/sid/VoiceprintCompare.cpp
modified: src/server/objects/sid/VoiceprintCompare.h

no changes added to commit (use "git add" and/or "git commit -a")
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: src/server/objects/kws/KeywordSpottingList.cpp
modified: src/server/objects/sid/SpeakerIdentificationGroupSpkModel.cpp

no changes added to commit (use "git add" and/or "git commit -a")

$ git commit -a -m "Fixed Content-Type checking"
[HEAD 0a50233] Fixed Content-Type checking
2 files changed, 11 insertions(+), 10 deletions(-)
$ git add include/rest/Utility.h
$ git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: include/rest/Utility.h

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: libs/rest/RESTObject.cpp
modified: src/server/objects/admin/AdminUser.cpp
modified: src/server/objects/kws/KeywordSpottingList.cpp
modified: src/server/objects/sid/SpeakerIdentificationGroupSpkModel.cpp
modified: src/server/objects/sid/VoiceprintCompare.cpp
modified: src/server/objects/sid/VoiceprintCompare.h
$ nano include/rest/Utility.h
$ git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: include/rest/Utility.h

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: include/rest/Utility.h
modified: libs/rest/RESTObject.cpp
modified: src/server/objects/admin/AdminUser.cpp
modified: src/server/objects/kws/KeywordSpottingList.cpp
modified: src/server/objects/sid/SpeakerIdentificationGroupSpkModel.cpp
modified: src/server/objects/sid/VoiceprintCompare.cpp
modified: src/server/objects/sid/VoiceprintCompare.h
$ git add --all
$ git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: src/server/objects/admin/AdminUser.cpp
modified: src/server/objects/kws/KeywordSpottingList.cpp

$ git commit -m "Fixed Content-Type checking"
[HEAD 0a50233] Fixed Content-Type checking
2 files changed, 11 insertions(+), 10 deletions(-)
$ git fetch
...
From odin.phonexia.com:/git/BSAPI-rest
5792ccc..aaa239b develop -> origin/develop

$ git status
On branch develop
Your branch is behind 'origin/develop' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working directory clean

$ git pull
Updating 53bc76a..843bf2d
Fast-forward
src/server/objects/stream/StreamHttp.h | 9 +++++++--
src/server/objects/stream/StreamRtp.h | 3 +++
src/server/objects/stt/Dictate.h | 14 ++++++--------
3 files changed, 16 insertions(+), 10 deletions(-)
$ git branch
* develop
master

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

$ git branch
develop
* master
Distribuovanýsystém
Větvení a slučování
$ git checkout -b iss53
$ git commit -a
$ git checkout master
$ git merge iss53
$ git merge iss53
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts and then commit the result.

$ git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")

Unmerged paths:
(use "git add <file>..." to mark resolution)

both modified: index.html

no changes added to commit (use "git add" and/or "git commit -a")
<<<<<<< HEAD
<div id="footer">contact : email.support@github.com</div>
=======
<div id="footer">
please contact us at support@github.com
</div>
>>>>>>> iss53
$ git mergetool

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc3 codecompare vimdiff emerge
Merging:
index.html

Normal merge conflict for 'index.html':
{local}: modified file
{remote}: modified file
Hit return to start merge resolution tool (opendiff):
Pracovní postup s integračním manažerem
Přispěvatel naklonuje repozitář a provede změny.
Přispěvatel odešle změny do své vlastní veřejné kopie.
Přispěvatel pošle správci e-mail s žádostí, aby natáhl změny do projektu.
Správce přidá repozitář přispěvatele jako vzdálený repozitář a provede lokální začlenění.
Správce odešle začleněné změny do hlavního repozitáře.
Pracovní postup s diktátorem a poručíky
Stálí vývojáři pracují na svých tematických větvích a přeskládávají svou práci na vrchol hlavní větve. Hlavní větev je větev diktátora.
Poručíci začleňují tematické větve vývojářů do svých hlavních větví.
Diktátor začleňuje hlavní větve poručíků do své hlavní větve.
Diktátor odesílá svou hlavní větev do referenčního repozitáře, aby si na jeho základě mohli ostatní vývojáři přeskládat data.
Práce se vzdáleným větvemi
$ git clone odin.phonexia.com:/git/BSAPI-rest
Cloning into 'BSAPI-rest'...
remote: Counting objects: 21570, done.
remote: Compressing objects: 100% (5017/5017), done.
remote: Total 21570 (delta 15584), reused 21329 (delta 15436)
Receiving objects: 100% (21570/21570), 3.46 MiB | 1.07 MiB/s, done.
Resolving deltas: 100% (15584/15584), done.
Checking connectivity... done.
$ nano deps.txt
$ git commit -a -m "Update BSAPI"
[develop 5792ccc] Update BSAPI
1 file changed, 1 insertion(+), 1 deletion(-)

$ git status
On branch develop
Your branch is ahead of 'origin/develop' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean

$ git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 285 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To /tmp/BSAPI-rest_client/../BSAPI-rest
9ffc679..5792ccc develop -> develop

Git není SVN!
Přeskládání
$ git checkout experiment
$ git rebase master
$ git checkout master
$ git merge experiment
$ git checkout --track origin/serverfix
Branch serverfix set up to track remote branch serverfix from origin.
Switched to a new branch 'serverfix'

$ git push origin --delete serverfix
To git@github.com:schacon/simplegit.git
- [deleted] serverfix
Změna historie
$ git commit --amend
$ git rebase -i HEAD~3
pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file

# Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
$ git filter-branch --tree-filter 'rm -f passwords.txt' HEAD
Rewrite 6b9b3cf04e7c5686a9cb838c3f36a8cb6a0fc2bd (21/21)
Ref 'refs/heads/master' was rewritten
Hledání chyb
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: index.html

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)

modified: lib/simplegit.rb

$ git stash
Saved working directory and index state "WIP on master: 049d078 added the index file"
HEAD is now at 049d078 added the index file
(To restore them type "git stash apply")

$ git status
On branch master
nothing to commit, working directory clean
$ git stash list
stash@{0}: WIP on master: 049d078 added the index file
stash@{1}: WIP on master: c264051 Revert "added file_size"
stash@{2}: WIP on master: 21d80a5 added number to log

$ git stash apply
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)

modified: index.html
modified: lib/simplegit.rb
$ git bisect start
$ git bisect bad
$ git bisect good v1.0
Bisecting: 6 revisions left to test after this
[ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo
$ git bisect good
Bisecting: 3 revisions left to test after this
[b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing
$ git bisect bad
Bisecting: 1 revisions left to test after this
[f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table
$ git bisect good
b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit
commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04
Author: PJ Hyett <pjhyett@example.com>
Date: Tue Jan 27 14:48:32 2009 -0800

secure this thing

:040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730
f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
Full transcript