Git: Theory Tools Git: Use Git: Tools Git and (Other) Tools for Cooperation
Total Page:16
File Type:pdf, Size:1020Kb
git: Theory Tools git: Use git: Tools Git and (other) Tools for Cooperation Project References Jörg Cassens, Rebekah Wegener, Jens Rademacher, Bastian Stender SoSe 2019 Lab Course Media Informatics SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 1 / 88 Outline git: Theory Architectures git 1 git: Theory git: Use Architectures git: Tools git Project References 2 git: Use 3 git: Tools 4 Project Management SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 2 / 88 Log of changes What, When, Who Possible to use previous versions Multi-user support Support branching, merging, redundancy Use of and Requirements for Version Control git: Theory Architectures git git: Use Administer dierent versions of a file git: Tools Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 3 / 88 Use of and Requirements for Version Control git: Theory Architectures git git: Use Administer dierent versions of a file git: Tools Project Log of changes References What, When, Who Possible to use previous versions Multi-user support Support branching, merging, redundancy SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 3 / 88 Outline git: Theory Architectures git git: Use git: Tools Project References Architectures SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 4 / 88 Architectures (1) git: Theory Architectures git git: Use git: Tools Local version control Project Versioning single files with simple administration (log, recover older versions of References file) Implementations: RCS, proprietary soware First generation, not suitable for groups SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 5 / 88 Architectures (2) git: Theory Architectures git git: Use git: Tools Central version control Project Central server, development on clients References Revision history on server Rights management on server Implementations: CVS (abandoned), SVN Second generation, suitable for groups, needs server SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 6 / 88 Architectures (3) git: Theory Architectures git Distributed version control git: Use Every client has a repository git: Tools No central server necessary Project but primus inter pares possible References Repositories update other repositories Version history might be on every client Parallel development with (tool-supported) merge aerwards (non-linear development) Implementations: Mercurial, Git Third generation, suitable for groups, supports oline and non-linear development SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 7 / 88 Outline git: Theory Architectures git git: Use git: Tools Project References git SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 8 / 88 Features git: Theory Architectures git Distributed version control git: Use git: Tools Originally developed by Linus Torvalds for the Linux kernel Project References no central server Supporting non-linear development through branching and merging Lots of transport protocol options No incremental ID, but hash-values for commits Authentication with repository-hosting services (primus inter pares) oen via private keys SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 9 / 88 (Dis-) advantages git: Theory Architectures git git: Use Advantages git: Tools no central server Project clean file system, only one “.git” directory in main directory References eicient work through branch, di, merge Disadvantages Requires discipline Linux thinking, might be diicult coming from Windows Steep learning curve Slow performance with large (and binary) files SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 10 / 88 Outline git: Theory 1 git: Theory git: Use New Repository Standard Tasks Remote-Repositories 2 git: Use Branching Other New Repository Tutorial Standard Tasks git: Tools Remote-Repositories Project Branching References Other Tutorial 3 git: Tools 4 Project Management SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 11 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools New Repository Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 12 / 88 Initialisation & .gitignore git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching New repositories: Other Tutorial git init (local in project directory, creates “.git”) git: Tools git --bare init (remote repository) Project Keeping files or file types out of version control: References text file .gitignore in main directory One rule per line (*.pdf) SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 13 / 88 git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Project References Workflow SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 14 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Standard Tasks Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 15 / 88 Base Functions File-Status: git: Theory Untracked (not under version control) git: Use Modified (New) (changed since last commit) New Repository Standard Tasks Staged (marked for commit) Remote-Repositories Branching Unmodified (unchanged since last commit) Other Tutorial Read status: git: Tools git status Project Add or stage files: References git add FILE(S) Commit: git commit -m “Comment“ Stage (deleted & modified) & Commit: git commit -a -m “Comment“ Show dierences to HEAD: git di HEAD SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 16 / 88 git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Project References lifecycle SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 17 / 88 Revert changes git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Revert changes of last commit, keep commit Other Tutorial git revert git: Tools HEAD-pointer to named commit Project git revert COMMIT References Stage/working directory to status of last commit git reset SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 18 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Remote-Repositories Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 19 / 88 Remote-Repositories git: Theory git: Use New Repository Standard Tasks make local copy of remote repository: Remote-Repositories Branching git clone URL Other Tutorial add remote repository: git: Tools git remote add REMOTENAME URL Project transfer local changes to remote repository: References git push REMOTENAME BRANCH REMOTENAME is oen origin Standard-Branch is master SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 20 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Branching Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 21 / 88 Branching git: Theory git: Use create branch New Repository Standard Tasks git branch NAME Remote-Repositories Branching show all branches Other Tutorial git branch -a git: Tools change to branch Project git checkout NAME References merge branch with master git checkout master (change into master) git merge NAME (Merge) delete branch git branch -d NAME SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 22 / 88 Branches git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Project References working with branches SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 23 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Other Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 24 / 88 Setting and help git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching (Global) settings Other Tutorial git config [--global] user.name “John Doe“ git: Tools git config [--global] user.email [email protected] Project git config [--global] core.autocrlf input (Linux) References Help git COMMAND --help SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 25 / 88 Outline git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Tutorial Project References SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 26 / 88 github Tutorial git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Project References Sadly, github removed the friendly Octocat tutorial... SoSe 2019 Jörg Cassens, Rebekah Wegener,Jens Rademacher, Bastian Stender – Tools 27 / 88 git Tutorial: Katacoda git: Theory git: Use New Repository Standard Tasks Remote-Repositories Branching Other Tutorial git: Tools Project References + katacoda.com/courses/git SoSe 2019 Jörg Cassens,