0% found this document useful (0 votes)
15 views

Introduction To Git and GitLab

Uploaded by

heavenkillgirls
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Introduction To Git and GitLab

Uploaded by

heavenkillgirls
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Introduction to

Git and GitLab


Welcome to the world of version control! This
presentation will introduce you to Git, a powerful tool for
tracking changes in your code. We'll also explore GitLab,
a web-based platform that provides a user-friendly
interface for managing Git repositories.
by Châu Gia Đạt
What is Git and why is it important?
• Git is a version control system that helps track changes in code over time.
• Git allows developers to work on projects collaboratively, making it easier to merge changes
and resolve conflicts.
• Git provides a history of all changes, making it easy to revert to previous versions or see who
made specific changes.
• Git is widely used in software development, making it a valuable skill for developers and programmers.
• Git enables efficient teamwork by allowing developers to work on different parts of a project
simultaneously, merging changes later.
Git Basics: Repositories, Commits,
Branches
Repositories Commits Branches

A repository is like a folder A commit is a snapshot of Branches are parallel lines of


that holds all the files and your code at a specific point development within a
history of a project. It's a in time. Every time you save repository. They allow you to
central location where you changes to your repository, work on new features or
can track and manage all you're creating a commit, experiment with changes
changes made to your code. which captures the state of without affecting the main
your project at that moment. line of code, called the
"master" branch. You can
merge branches back into the
main branch once you're
ready to integrate your
changes.
Collaborating with Git: Cloning, Pushing,
Pulling
Cloning Pushing Pulling
Cloning creates a local copy Pushing uploads your local Pulling downloads the latest
of a remote repository on changes to the remote changes from the remote
your computer, allowing you repository, making them repository to your local copy,
to work on the project. accessible to other ensuring you have the most
collaborators. up-to-date version of the
code.
GitLab: a web-based Git repository
manager
GitLab is a web-based platform that offers a
user-friendly interface for managing Git
repositories. It provides a centralized location for
your Git projects, allowing you to collaborate
with others seamlessly.
GitLab streamlines collaboration by providing
tools for issue tracking, code review, continuous
integration and delivery (CI/CD), and project
management. It also offers features like wikis for
documentation, issue boards for task
management, and analytics for project insights.
Communicate
with GitLab
Using SSH Keys
SSH keys are a secure way to authenticate with GitLab.
They provide a secure connection for pushing and pulling
code.
Committing changes and pushing
to GitLab
Stage Changes
Use the 'git add' command to stage the files you want to commit. This
prepares them for inclusion in the next commit.

Commit Changes
Create a commit with a descriptive message explaining the changes
you've made using 'git commit -m "Your commit message".'

Push to GitLab
Use 'git push origin main' to upload your local changes to the remote
GitLab repository, making them accessible to others.
Branching and merging in GitLab

Create a branch
1 Make a copy of the main branch to work on a new feature.

Make changes
2
Modify code on the branch without affecting the original code.

Commit changes
3 Save your work on the branch with descriptive commit
messages.

Merge branch
4 Integrate the changes from your branch into the
main branch.

Branching allows teams to work on different tasks simultaneously without disrupting others. Merging
combines changes from a branch into the main branch, updating the project with new features or bug
fixes.
Resolving Conflicts and Managing Issues
Identify Conflicts
1
GitLab will highlight conflicting changes when merging branches.

Resolve Conflicts
2
Manually edit the code to combine changes from both branches.

Commit Resolution
3 Commit the resolved changes to the branch and complete
the merge.

Issue Tracking
4 GitLab provides a platform for reporting,
managing, and resolving issues.

Conflicts occur when two developers make changes to the same part of the code. GitLab's conflict
resolution tools help you identify and resolve these issues. GitLab's issue tracking system allows for
efficient collaboration on bug fixes and feature requests.
Best Practices and Tips for Using Git and
GitLab

Code Reviews Branching Descriptive Issue Tracking


Strategy Commit
Conduct regular code Use GitLab's issue
Messages
reviews to identify Use a consistent Write clear and tracker to manage
bugs and improve branching strategy, concise commit bugs, feature
code quality. such as GitFlow, to messages explaining requests, and tasks
manage development the changes made. efficiently.
workflows effectively.

You might also like