<<
Home , Git

Git and

CS-A1123 Basics in Programming Y2 (5 ECTS) Version control systems • Any software will soon branch out to multiple versions – Old distributed versions that need updates and security patches – Main stable version – Simultaneous development versions for new features • Version control software (Git, SVN, CVS, etc.) is used to manage these – A repository contains all branches and their various versions – A working copy for developers deployment release – Changes can be kept separate or merged back to the mainline

version 0.9 1.0 1.0.1 1.2 V 2.0

1.1 1.1.2

1.1.1 Projects and versioning

• Many versioning systems are based on the concept of project as the comprehensive unit of work • A project contains all versions of the software and additional material – Working copies may be worked on by separate developers • Implicitly creating several separate branches on the project – Branches can be created in the project itself • Often ends up with a tree like structure • Branches for deployed versions that need to be maintained • Branches for new development work to be tested and merged to the main branch • The branches are independent – Changes in one branch are not automatically deployed to others – Each branch has its own version history • A developer may take out different versions of different branches to work • Parallel development work requires software tools – Changes can conflict or be difficult to

3 Git and version control • Git is one popular tool available for distributed version control – Has been created especially for the project, but is generic – Designed to scale especially for large distributed projects and parallel creation of complex software • Git is based on centralized storage and local copy – Works offline until one wants to update others' work or own • Multiplatform product – Most -based OSes, MacOS, Windows – Many IDEs support git, e.g., PyCharm, , Visual Studio, Android Studio, GNU • Other popular tools exist, too – SVN (Subversion), CVS (Concurrent Versions System) ...

working copy local repository remote repository

4 Using Git

• Two common starting points – create a new project (git init) – Clone an existing project to local storage (git clone) • Files in Git – Need to be added (git add), can be removed (git rm) – Status check often useful (git status) – Git directories contain two types of files, tracked files versioned by Git and untracked files Git is not aware of (e.g., locally compiled binaries) • Updating the repository – Local commit of own work for versioning (git commit) • Creates a point that can be returned to later – Shared commit to central repository (git push) – Others' changes from central repository (git pull) – Merging changes (git merge)

5 Using Git

Your workstation In the net

Working Staging Local Remote directory area repository repository

git clone git init Getting started

git add git commit -a git push Changes

git fetch git checkout

git pull

6 Git tällä kurssilla ja Aallossa

• Gitiä käytetään tällä kurssilla projektityön palauttamiseen – Opiskelija tekee itselleen oman projektirepositorion Aallon omaan Gitiin (https://version.aalto.fi) – Opiskelija lisää assarinsa ja kurssin vastuuopettajan projektiinsa • Käytämme Gitiä myös harjoitustehtävien neuvonnassa – https://version.aalto.fi/gitlab/sos/y2-2021qa/issues – Issue tracker –toiminto on alunperin tarkoitettu esimerkiksi virheiden raportointiin – Muut projektiin (kurssille) osallistuvat näkevät aiemmat kysymykset ja niiden vastaukset kohdasta “closed”

7 Using Git on this Course and at Aalto

• Git is used on this course to return the project – Create your own project repository at Aalto Git https://version.aalto.fi – Add your TA and teacher to your project We are also using Git's "Issue Tracker" feature for questions and answers on the assignments – https://version.aalto.fi/gitlab/sos/y2-2021qa/issues – Originally intended for problem reports – Used on this course, so that everybody on the course can see others' problems and their replies

8