Software Engineering Tools and Practices Learn Git
BeHappy728244
7 views
24 slides
Aug 28, 2024
Slide 1 of 24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
About This Presentation
learn GIT
Size: 585.42 KB
Language: en
Added: Aug 28, 2024
Slides: 24 pages
Slide Content
SE Tools and Practices
(SE 2142)
Consultation Time
TF - 1300-1430
Course Syllabus
Classroom Rules
Late Policy:
You will be marked late if I have already finished checking attendance, but you are still welcome to join the class.
Materials for Seat-Work or Quizzes:
Please bring newsprint, a blue or black pen, and preferably a red pen for checking.
What If:
● You forget to bring a pen or newsprint? I’ll give you time to review, during which you can purchase them from the canteen.
● You don’t have a red pen for checking? It’s okay as long as there are no erasures or overwriting on the answers on your newsprint, or it is better if you use a different color pen.
If you fail to follow these instructions after being reminded, your score will be 0 for not adhering to the guidelines. ;)
Quizzes:
Chapter quizzes will be announced in advance, while other quizzes may occur at any time during the course, often following discussions.
** Take note and listen :)
**The purpose of this is to help you get accustomed to following instructions, even the small ones.
After all, in the future, no matter how well you design a system, it could still be rejected if you overlook a single simple
requirement. :)
What is version control?
Version control, also known as source control, is the practice of tracking and managing changes to
software code.
Version control systems are software tools that help software teams manage changes to source
code over time so that you can recall specific versions later.
Version control helps solve these kinds of problems and provides:
●complete history of every file
●ability to work on independent streams of changes
●ability to trace each change
Types of Version Control Systems
Centralized Version Control (CVCS):
●A single server stores all versions of the files.
●Developers “check out” files to make changes.
●Example: Subversion (SVN).
Distributed Version Control (DVCS):
●Each developer has a complete copy of the repository.
●Changes can be committed locally before sharing.
●Example: Git, Mercurial.
Why use version control?
Collaboration:
●Multiple developers can work on the same project simultaneously.
●Avoids conflicts by merging changes from different developers.
History Tracking:
●Every change is logged with a timestamp, author, and message.
●Provides a full history of the project.
Backup and Restore:
●Easy to restore previous versions of files.
●Protects against accidental loss of data.
Branching and Merging:
●Allows working on multiple features or fixes in parallel.
●Changes can be merged into the main project seamlessly.
Real-World Example of Version Control
Scenario: A team of developers is working on a software project.
Without Version Control:
●Difficulty tracking changes.
●High risk of overwriting each other's work.
●No easy way to revert to a previous stable state.
With Version Control:
●Each developer works on their own branch.
●Changes are tracked, reviewed, and merged.
●Ability to revert to previous versions if a bug is introduced.
What is Git?
By far, the most widely used modern version control system in the world today is Git. Git is a mature,
actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous
creator of the Linux operating system kernel.
Git is an example of a DVCS (hence Distributed Version Control System).
Performance
Committing new changes, branching, merging and comparing past versions are all optimized for performance.
Unlike some version control software, Git is not fooled by the names of the files when determining what the storage and
version history of the file tree should be, instead, Git focuses on the file content itself.
Security
The content of the files as well as the true relationships between files and directories, versions, tags and commits, all of
these objects in the Git repository are secured with a cryptographically secure hashing algorithm called SHA1.
Flexibility
Git is flexible in several respects: in support for various kinds of nonlinear development workflows, in its efficiency in both
small and large projects and in its compatibility with many existing systems and protocols.
In addition to being distributed, Git has been designed with performance, security and flexibility in mind.
Version control with Git
Git is Good:
Git offers the functionality, performance, security, and flexibility that most developers need, making it a strong choice compared to
alternatives.
Git is a De Facto Standard:
Git is widely adopted, making it easy for teams to find developers with Git experience and access to many integrated tools and
services.
Git is a Quality Open Source Project:
Git is a well-supported, open-source project with strong community support, excellent documentation, and a decade of reliable
stewardship.
Criticism of Git:
While Git has a learning curve, especially for new users, its powerful features ultimately enhance development speed and flexibility.
Git for developers
Feature branch workflow
Feature branches provide an isolated
environment for every change to your
codebase. When a developer wants to start
working on something—no matter how big
or small—they create a new branch. This
ensures that the main branch always
contains production-quality code.
Distributed development
In SVN, each developer gets a working copy that points back to a single central repository. Git, however, is a distributed
version control system. Instead of a working copy, each developer gets their own local repository, complete with a full
history of commits.
Pull request
A pull request is a way to ask another developer to merge one of your branches into their repository. This not only
makes it easier for project leads to keep track of changes, but also lets developers initiate discussions around their
work before integrating it with the rest of the codebase.
Community
In many circles, Git has come to be the expected version control system for new projects. If your team is using Git,
odds are you won’t have to train new hires on your workflow, because they’ll already be familiar with distributed
development.
Fastest release cycle
The ultimate result of feature branches, distributed development, pull requests, and a stable community is a faster
release cycle. These capabilities facilitate an agile workflow where developers are encouraged to share smaller
changes more frequently. I
Basic Git Commands
●git init: How to initialize a new repository.
●git clone: How to clone an existing repository
●git add: How to stage changes.
●git commit: How to commit staged changes.
●git status: How to check the status of the working directory and staging area.
●git log: How to view commit history.
Working with branches
Creating and Switching Branches
●git branch: How to create a new branch.
git branch new_branch
●git checkout: How to switch between branches
git checkout [<branch>]
Merging Branches
●git merge: How to merge branches.
Comparing Git with Other Version Control Systems
Summary
What is Git?
●Distributed Version Control System (DVCS)
●Tracks changes in source code during software development
Key Features:
●Distributed Architecture: Each user has a full copy of the repository, enabling offline work and redundancy.
●Branching and Merging: Efficient, lightweight branches and advanced merging capabilities support flexible workflows.
●Performance: Fast local operations and optimized storage using delta encoding.
●Data Integrity: Uses SHA-1 hashing to ensure data integrity and detect corruption.
●Customization: Supports various workflows, custom hooks, and extensions.
●Ecosystem: Extensive integration with platforms like GitHub, GitLab, and Bitbucket.
●Open Source: Free to use and actively developed with contributions from a large community.