This presentation is about a lecture I gave within the "Software systems and services" immigration course at the Gran Sasso Science Institute, L'Aquila (Italy): http://cs.gssi.infn.it/.
http://www.ivanomalavolta.com
5. Global software engineering
Collaboration
When the technology brings improvements to the shared space or to the
way users interact with shared artifacts synchronously or asynchronously
Coordination
When the technology brings improvements to the support offered for
people managing themselves, or themselves within a team
Communication
When the technology brings improvements to the way messages and
information are exchanged among people, reducing gaps, ambiguity, or
the effort needed to understand, establish, or continue a conversation
Awareness
An understanding of the activities of others, which provides a context for
yourown activity
6. Version control
âA systemthat records changes to a file or set
of files over time so that you can recall specific
versions laterâ
Files can refer to anything:
âą source files
âą images
âą Powerpoint slides
âą documents
Ă more concretely,if you screw things up or lose files, you can
easily recover!
10. Git
âą Distributed Source Control system
âą Open source, free (GNU GPL V2)
âą Came out of Linux development community
â Linus Torvalds, 2005
âą Goals:
â Speed
â Simple design
â Strong support for non-linear development (thousands of parallel
branches)
â Fully distributed
â Able to handle large projects like the Linux kernel efficiently
(speed and data size)
11. Key points of Git
âą Snapshot-based
â no deltas
âą Integrity
â Checksums as identification scheme
âą Three states
â working-staging-production
12. Key points: snapshot based
Storing data as
changes to a
base version of
each file
Storing data as
snapshots of
the project over
time
13. key points: integrity
âą Everything in Git is check-summed before it is stored
â This means itâs impossible to change the contents of any file or directory
without Git knowing about it
âą Git generates a unique SHA-1 hash â 40 character string of
hex digits, for every commit
âą Git identifies files and directories by their ID rather than a
version number
â Often you will see only the first 7 characters:
1677b2d Edited first line of readme
258efa7 Added line to readme
0e52da7 Initial commit
15. Key points: 3 states
You modify files in yourworking directory
Basic Git workflow:
You stage the files, adding snapshots of them
to your staging area
You do a commit, which takes the files as
they are in the staging area and stores that
snapshot permanently to your Git directory
1
2
3
16. A more complete workflow
http://documentup.com/skwp/git-workflows-book
17. Commands
Contents of this part of lecture coming from
https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf
28. Branching
Branch = an independent line of development
Each branch has its own working directory, staging area, and project
history
Git branches are extremely light and fast
â Instead of copying files from directory to directory, Git stores a branch as a
reference to a commit
image from https://www.atlassian.com/git/tutorials/using-branches/git-branch
29. Branching workflow
Git ENCOURAGES workflows that branch and merge often, even
multiple times in a day
When you want to add a new feature or fix a bugâno matter how big
or howsmallâyou spawn a new branch to encapsulate your changes
https://www.atlassian.com/git/tutorials/using-branches/git-branch
The main code base
is always stable
It is possible to work
in parallel on different
features
30. Branching and merging
Imagine you already have 3 commits in your project
Master= The main branch in your project
â Doesnât have to be called master, but almost always is!
31. Creating branches
You have to fix issue #53 of your project
Ă you create a branch called iss53
You fix the issue and commit
32. Switching branches
Now there is an issue with your production code (e.g., a new bug)
Ă you have to switch to the master branch
Letâs make the hotfix
By doing this, Git will reset yourworking
directory at the last commit of the branch
33. Merging branches
Afteryou checked your hotfix,you can put it in production
Ă you merge the hotfix branch with master
Letâs make the hotfix
Fast-forward: Git just moves the master
pointer forward towards hotfix
34. Deleting branches
Now the hotfix branch is no longer needed because it points to the
same place as master
Ă you delete the hotfix branch
And nowyou can continue working on your iss53
35. Merging branches
If yourwork on iss53 is finished, then you can put it in production
Ă you merge iss53 into the master branch
This is not a fast-forward merge
In this case Git automatically does a 3-way
merge between the 2 snapshots to be
merged and the common ancestor
36. Merging branches 1
If yourwork on iss53 is finished, then you can put it in production
Ă you merge iss53 into the master branch
This is not a fast-forward merge
In this case Git automatically does a 3-way
merge between the 2 snapshots to be
merged and the common ancestor
37. Merging branches 2
Git automatically creates:
1. a new snapshot containing the result of the 3-way merge
2. a new commit pointing to the new snapshot
If you changed the same part of the same file -> CONFLICT
38. GitHub
A site for online storage of Git repositories
â You can get free space for open source projects
â or you can pay for private projects
Adds extra functionalities, like:
â web UI
â documentation
â bug tracking (issues)
â feature requests, pull requests
â social interactions among developers
âą following, check activities, discover new repos
It is not mandatory, you can:
âą use Git locally
âą setup a private Git server
39. Lab
1. Register to GitHub
2. fork this repo: https://github.com/iivanoo/rest-biter
3. create a Python script your_name.py
4. in the script, add a simple function definition that does something
(even just a print statement)
5. in restBiter.py add:
â an import statement for importing your Python script of step 4
â a statement for calling the function defined in your Python script
6. test the main function by running the script in the terminal:
python restBiter.py http://www.google.com 2 0 500 1000
7. do commit and push your changes to your repo
8. [optional] open a newpull request to merge your changes with the
original repo
40. References
âą Official git site and tutorials
â https://git-scm.com
âą GitHub guides
â https://guides.github.com
âą Commands cheatsheet
â https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf