Week3 Git
Week3 Git
Week3 Git
Week 3
Software Engineering
Wk Lecture Practical
1 Introduction Canvas, Assessment Understand the case study.
Software lifecycle Write the user stories.
Design the database and the
2 Work as a group! Agile
software
Plan the work on the UI Review of the OOP concepts.
Set the version control
and the Use Case diagram.
What do you do when you want to get rid of a piece of code written
a while ago.
Do not confuse the version database used by Git to store the project with
the database used inside the project!
The staging area – is a file that stores information about what will
go into the next commit.
$ git init
Clone an existing project
Example:
# ignore the .cache files
*.cache
# ignore the .resources files
*.resources
Commit the changes
$ git commit
All the staged files are added (checked in) to the repository.
Commit the changes
Example:
$ git commit
The lines 30-40 are not in the file1.cs that is in the repository
Commit the changes
$ git commit -a
All the files are staged before they are committed to the repository.
It is equivalent to:
$ git add
$ git commit
See the changes done to the files
$ git status
$ git diff
$ git rm file
git log displays a list of all the commits made in the repository.
$ git log
$ git log -p
Git - Branches
43fa2
Master
Master
Create a branch
Master
Master
Task1
af34c
Master
Switch between branches
Task1
af34c
53cd2
Master
Switch between branches
Task1
af34c
53cd2
Master
Example 1
Any comment?
Example 1
af34c
Master
Merge branches
af34c
Master
Delete branches
af34c
Master
Example 2
A fix was required on the master. File1 (from master) was updated.
af34c e29ba
53cd2
Master
Example 2
af34c e29ba
53cd2
Master
Example 2
$ git status
Stage and then commit the files changed to finalise the merge.
Branching Workflows
The remote branches are similar to the local branches but stored on
the server and therefore accessible by the whole team.
server
Local
computer
Commits are done to the local branch. The local and the remote
branches are unsynchronised.
server
Local
computer
$ git fetch
server
Local
computer
server
Local
computer
GitHub
https://github.com/
Reading list
Chapters 5 and 6
Questions