0% found this document useful (0 votes)
13 views27 pages

ICT3715 DevOps

dev ops in unisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views27 pages

ICT3715 DevOps

dev ops in unisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lesson:

Integrating DevOps into Software Development:


Principles, Tools, and Practices

February 18, 2025


CONTENTS

1 INTRODUCTION 4
1.1 Introduction to DevOps (20 minutes) . . . . . . . . . . . . . . . . . . . 4
1.1.1 What is DevOps? . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.2 Why DevOps? . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.3 DevOps Principles: . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 DevOps Tools and Technologies 9


2.1 DevOps Tools and Technologies (30 minutes) . . . . . . . . . . . . . . 9
2.1.1 Version Control Systems: . . . . . . . . . . . . . . . . . . . . . 9
2.2 Key Git Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 GitHub and GitLab: Enhancing Git . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Continuous Integration and Continuous Deployment (CI/CD)
Pipelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 DevOps Culture and Collaboration 14


3.1 DevOps Culture and Collaboration (20 minutes) . . . . . . . . . . . . . 14
3.1.1 Importance of Collaboration: . . . . . . . . . . . . . . . . . . . . 14
3.1.2 Communication Tools: . . . . . . . . . . . . . . . . . . . . . . . 14
3.1.3 Agile and DevOps: . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Integrating DevOps into the Capstone Project (30 minutes) . . . . . . 14
3.2.1 Group Discussion: . . . . . . . . . . . . . . . . . . . . . . . . . 14

4 DevOps in Practice 16
4.1 DevOps in Practice (40 minutes) . . . . . . . . . . . . . . . . . . . . . 16
4.2 Setting Up a Repository on GitHub . . . . . . . . . . . . . . . . . . . . 16

1
CONTENTS 2

4.2.1 Step 1: Create a GitHub Account . . . . . . . . . . . . . . . . . 16


4.2.2 Step 2: Create a New Repository . . . . . . . . . . . . . . . . . 17
4.2.3 Step 3: Clone the Repository to Your Local Machine . . . . . . 17
4.2.4 Step 4: Make Changes and Commit Them . . . . . . . . . . . . 18
4.2.5 Step 5: Collaborate and Manage Your Repository . . . . . . . . 19
4.2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

5 Version control 20
5.1 Activity 2: Version Control . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 Version Control Best Practices for GitHub . . . . . . . . . . . . . . . . 20
5.2.1 Setting Up a Repository . . . . . . . . . . . . . . . . . . . . . . 20
5.2.2 Branching Strategy . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.3 Commit Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2.4 Collaboration and Code Review . . . . . . . . . . . . . . . . . . 21
5.2.5 Maintaining Repository Health . . . . . . . . . . . . . . . . . . . 21

6 VERSION CONTROL - PRACTICE 22


6.1 Version Control Best Practices for GitHub . . . . . . . . . . . . . . . . 22
6.1.1 Setting Up a Repository . . . . . . . . . . . . . . . . . . . . . . 22
6.1.2 Branching Strategy . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.1.3 Commit Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.1.4 Collaboration and Code Review . . . . . . . . . . . . . . . . . . 23
6.1.5 Maintaining Repository Health . . . . . . . . . . . . . . . . . . . 23
6.2 Step-by-Step Guide to Using GitHub Effectively . . . . . . . . . . . . . 23
6.2.1 Step 1: Set Up Git and GitHub . . . . . . . . . . . . . . . . . . 23
6.2.2 Step 2: Create a Repository . . . . . . . . . . . . . . . . . . . . 24
6.2.3 Step 3: Clone the Repository . . . . . . . . . . . . . . . . . . . 24
6.2.4 Step 4: Make and Track Changes . . . . . . . . . . . . . . . . . 24
6.2.5 Step 5: Push Changes to GitHub . . . . . . . . . . . . . . . . . 25
6.2.6 Step 6: Work with Branches . . . . . . . . . . . . . . . . . . . . 25
6.2.7 Step 7: Keep Your Repository Updated . . . . . . . . . . . . . . 25
CONTENTS 3

6.2.8 Step 8: Resolve Conflicts (If Any) . . . . . . . . . . . . . . . . . 26


6.2.9 Step 9: Collaborate Using Pull Requests . . . . . . . . . . . . . 26
6.2.10 Step 10: Automate and Maintain Repository . . . . . . . . . . . 26
CHAPTER 1

INTRODUCTION

Learning Objectives

By the end of this lesson, you will be able to:

1. Understand the core principles and benefits of DevOps in software


development.

2. Identify key DevOps tools and practices relevant to their capstone project.

3. Apply DevOps practices (e.g., CI/CD, version control, automated testing) to


their software development process.

4. Collaborate effectively in a DevOps-oriented team environment.

1.1 Introduction to DevOps (20 minutes)

1.1.1 What is DevOps?

• Definition: A set of practices that combines software development (Dev) and IT


operations (Ops) to shorten the development lifecycle and deliver high-quality
software continuously.

In the fast-paced world of software development, businesses need to deliver


high-quality applications quickly and efficiently. DevOps, a combination of
Development (Dev) and Operations (Ops), is a modern approach that

4
1.1. INTRODUCTION TO DEVOPS (20 MINUTES) 5

bridges the gap between software development and IT operations. It focuses


on automation, collaboration, and continuous delivery to streamline the
software development lifecycle.

DevOps is not just a set of tools; it is a culture and methodology that


enhances teamwork between developers, testers, and system administrators.
By adopting DevOps principles, organisations can reduce deployment time,
improve software reliability, and respond faster to customer needs.
Key DevOps practices include Continuous Integration (CI), Continuous
Deployment (CD), Infrastructure as Code (IaC), and Monitoring & Logging.

For ICT professionals, understanding DevOps is essential, as it equips them


with the skills to automate workflows, manage cloud environments, and
develop scalable applications. This module will introduce you to the core
concepts, tools, and best practices of DevOps, preparing you for modern
software development and operations roles.

• Historical context: From waterfall to Agile to DevOps.

Software development has evolved significantly over time. Initially, the Waterfall
model was the dominant approach, featuring a sequential development
process where each phase had to be completed before the next could begin.
However, this rigid structure often led to long development cycles and difficulties
in adapting to changing requirements.

To address these challenges, the Agile methodology emerged in the early


2000s. Agile promoted iterative development, frequent feedback, and flexibility,
allowing teams to adapt to evolving project needs. This shift improved
collaboration and accelerated software delivery but still lacked seamless
integration between development and operations teams.

DevOps arose as a natural progression from Agile, focusing on bridging the


gap between development and operations through automation, continuous
1.1. INTRODUCTION TO DEVOPS (20 MINUTES) 6

integration, and continuous deployment. By fostering a culture of collaboration


and leveraging modern tools, DevOps enables organisations to deliver software
faster, with greater reliability and efficiency.

1.1.2 Why DevOps?

• Faster delivery, improved collaboration, and higher reliability.

The adoption of DevOps has become essential for modern software


development due to its numerous benefits. Traditional software development
approaches often suffered from slow release cycles, miscommunication
between teams, and operational inefficiencies. DevOps addresses these issues
by fostering a culture of collaboration and automation.

Key reasons why DevOps is important:

– Faster Software Delivery: Continuous Integration and Continuous


Deployment enable frequent and reliable software releases, reducing time-
to-market.

– Improved Collaboration: DevOps unites developers, operations teams,


and other stakeholders, ensuring better communication and teamwork.

– Enhanced Software Quality: Automated testing and monitoring reduce


errors and improve software reliability.

– Scalability and Flexibility: DevOps practices support cloud computing


and infrastructure as code, making systems more adaptable to changes.

– Increased Efficiency: Automation of repetitive tasks, such as deployment


and configuration management, frees up resources for innovation.

By embracing DevOps, organisations can achieve a competitive edge,


streamline development processes, and improve the overall efficiency of
software delivery.

• Real-world examples.
1.1. INTRODUCTION TO DEVOPS (20 MINUTES) 7

Many industry leaders have successfully implemented DevOps to improve their


software development and operations processes. Here are some notable
examples:

– Amazon: Amazon adopted DevOps to automate infrastructure


management and speed up software deployments. This enabled them to
deploy code every 11.7 seconds, significantly improving system reliability
and scalability.

– Netflix: Netflix leverages DevOps to ensure seamless streaming


experiences for millions of users worldwide. By using Continuous
Deployment and automated monitoring tools, they can quickly detect and
resolve issues.

– Google: Google employs Site Reliability Engineering (SRE), a DevOps-


related practice, to manage large-scale distributed systems and maintain
high availability across its services.

– Facebook: Facebook integrates DevOps principles into its development


process, allowing for multiple deployments per day while ensuring stability
and security.

These examples demonstrate how DevOps helps organisations innovate faster,


improve system reliability, and enhance user experiences.

1.1.3 DevOps Principles:

DevOps is built upon a set of fundamental principles that guide its implementation
and success. These principles include:

• Collaboration and Communication: DevOps fosters a culture of open


communication and teamwork between developers, operations, and other
stakeholders to ensure smooth workflows and shared responsibilities.
1.1. INTRODUCTION TO DEVOPS (20 MINUTES) 8

• Automation: Automating repetitive tasks such as testing, deployment, and


infrastructure provisioning reduces human error and speeds up development
cycles.

• Continuous Integration and Continuous Deployment (CI/CD): Regularly


integrating and deploying small changes ensures software remains stable,
reducing risks associated with large releases.

• Monitoring and Feedback: Continuous monitoring of applications and


infrastructure allows teams to identify and address issues proactively, improving
system reliability.

• Security and Compliance: DevSecOps, an extension of DevOps, ensures


security is integrated into the development process, reducing vulnerabilities and
compliance risks.

• Infrastructure as Code (IaC): Managing infrastructure through code enables


consistency, scalability, and rapid provisioning of environments.

• Customer-Centric Approach: DevOps aligns development efforts with


customer needs, ensuring rapid feedback loops and feature improvements
based on user experience.

By adhering to these principles, organisations can streamline their software


development processes, enhance collaboration, and deliver high-quality applications
efficiently.
CHAPTER 2

DEVOPS TOOLS AND TECHNOLOGIES

2.1 DevOps Tools and Technologies (30 minutes)

In modern software development, effective source code management is essential for


collaboration, version control, and project organization. Git is a powerful distributed
version control system that allows developers to track changes, collaborate efficiently,
and maintain a history of their work. Platforms like GitHub and GitLab provide
hosting services for Git repositories, enabling teams to manage code repositories,
automate workflows, and integrate with CI/CD pipelines.

This chapter provides an overview of Git, its fundamental concepts, and how
GitHub/GitLab enhance source code management.

2.1.1 Version Control Systems:

• Git and GitHub/GitLab for source code management.

Git is a distributed version control system designed to handle everything from


small to large-scale projects with speed and efficiency. It enables developers to:

• Track changes in source code.

• Work on different versions of a project simultaneously using branches.

• Merge changes from multiple contributors.

• Maintain a detailed history of modifications.

9
2.2. KEY GIT CONCEPTS 10

Git operates through local and remote repositories, ensuring that developers can
work offline and sync changes when needed.

2.2 Key Git Concepts

• Repository (Repo): A Git project that contains all files and their revision
history.

• Commit: A snapshot of changes made to the repository.

• Branch: A separate line of development within a repository.

• Merge: The process of integrating changes from one branch into another.

• Clone: A copy of a repository that allows local development.

• Push/Pull: Commands used to send changes to and retrieve updates from a


remote repository.

2.3 GitHub and GitLab: Enhancing Git

GitHub and GitLab are web-based platforms that provide hosting for Git repositories
along with additional tools for collaboration, automation, and security. Some key
features include:

• Remote Repositories: Store and share code with teams.

• Pull Requests and Merge Requests: Facilitate code review and collaboration.

• Issue Tracking: Manage project tasks and bug reports.

• CI/CD Integration: Automate testing and deployment.

• Access Control and Permissions: Define roles for team members.

While GitHub is widely used for open-source projects, GitLab offers more built-in
DevOps tools and self-hosting options, making it a preferred choice for enterprise
environments.
2.3. GITHUB AND GITLAB: ENHANCING GIT 11

2.3.1 Continuous Integration and Continuous Deployment

(CI/CD) Pipelines

Continuous Integration (CI) and Continuous Deployment (CD) are essential practices
in modern software development. They enable developers to automate the process of
integrating code changes, testing, and deploying applications. This section provides
an overview of CI/CD pipelines and introduces some popular tools used in the
industry.

What is a CI/CD Pipeline?

A CI/CD pipeline is a series of automated steps that facilitate the process of


integrating code changes, running tests, and deploying applications. The pipeline
ensures that code changes are continuously integrated into a shared repository,
tested, and deployed to production environments with minimal manual intervention.

Key Components of a CI/CD Pipeline

• Source Control Management (SCM): The process begins with developers


committing code changes to a version control system (e.g., Git). This is where
the CI/CD pipeline is triggered.

• Build Automation: The pipeline automatically compiles the code and


packages it into executable artifacts.

• Automated Testing: The pipeline runs a suite of automated tests (unit tests,
integration tests, etc.) to ensure that the code changes do not introduce bugs.

• Deployment: Once the code passes all tests, it is automatically deployed to a


staging or production environment.

• Monitoring and Feedback: After deployment, the pipeline monitors the


application for any issues and provides feedback to the development team.
2.3. GITHUB AND GITLAB: ENHANCING GIT 12

Popular CI/CD Tools

There are several tools available to implement CI/CD pipelines. Below are some of
the most widely used tools:

• Jenkins: An open-source automation server that supports building, deploying,


and automating any project. Jenkins is highly extensible with a large plugin
ecosystem.

• GitLab CI/CD: Integrated directly into GitLab, this tool provides a seamless
experience for managing CI/CD pipelines alongside your code repositories.

• CircleCI: A cloud-based CI/CD tool that integrates with GitHub and Bitbucket.
It is known for its speed and ease of use.

• Travis CI: A hosted CI service that integrates with GitHub repositories. It is


particularly popular for open-source projects.

• Azure DevOps: A Microsoft product that provides a comprehensive suite of


tools for CI/CD, including build pipelines, release management, and testing.

• GitHub Actions: A CI/CD tool integrated into GitHub that allows you to
automate workflows directly from your repository.

• TeamCity: A CI/CD tool from JetBrains that supports a wide range of build and
deployment scenarios.

Benefits of CI/CD Pipelines

• Faster Time-to-Market: Automated pipelines reduce the time required to


integrate, test, and deploy code changes.

• Improved Code Quality: Automated testing ensures that code changes are
thoroughly tested before being deployed.

• Reduced Risk: Frequent integration and testing reduce the risk of introducing
bugs into the production environment.
2.3. GITHUB AND GITLAB: ENHANCING GIT 13

• Collaboration: CI/CD pipelines encourage collaboration among team


members by providing a consistent and automated process for integrating code
changes.
CHAPTER 3

DEVOPS CULTURE AND COLLABORATION

3.1 DevOps Culture and Collaboration (20 minutes)

3.1.1 Importance of Collaboration:

• Breaking down silos between development and operations teams.

• Shared responsibility for the entire software lifecycle.

3.1.2 Communication Tools:

• Slack, Microsoft Teams, or Discord for team communication.

3.1.3 Agile and DevOps:

• How Agile methodologies complement DevOps practices.

3.2 Integrating DevOps into the Capstone Project (30 minutes)

3.2.1 Group Discussion:

• How can DevOps practices be applied to their capstone project?

• Identify areas for automation, CI/CD, and monitoring.

• Create a DevOps roadmap for you project, including:

1. Version control strategy.

2. CI/CD pipeline setup.

14
3.2. INTEGRATING DEVOPS INTO THE CAPSTONE PROJECT (30 MINUTES) 15

3. Testing and deployment automation.

4. Monitoring and feedback mechanisms.


CHAPTER 4

DEVOPS IN PRACTICE

4.1 DevOps in Practice (40 minutes)

For the purpose of this course, we will focus on using GitHub.


Watch these videos for an introduction:
https://youtu.be/pBy1zgt0XPc?si=dFVzqSzyX8jpzFEe

https://youtu.be/RGOj5yH7evk?si=pfLH97uBenV4WBoV

4.2 Setting Up a Repository on GitHub

GitHub is a widely used platform for version control and collaboration. This section
provides step-by-step instructions on how to set up a repository on GitHub.

4.2.1 Step 1: Create a GitHub Account

If you do not already have a GitHub account, follow these steps to create one:

1. Go to https://github.com/.

2. Click on the Sign up button.

3. Enter your username, email address, and password.

4. Complete the verification process.

5. Click on the Create account button.

16
4.2. SETTING UP A REPOSITORY ON GITHUB 17

4.2.2 Step 2: Create a New Repository

Once you have a GitHub account, you can create a new repository by following these
steps:

1. Log in to your GitHub account.

2. Click on the + icon in the top-right corner of the page and select New
repository.

3. On the Create a new repository page, fill in the following fields:

• Repository name: Enter a name for your repository (e.g., my-project).

• Description: Optionally, provide a brief description of your repository.

• Visibility: Choose between Public (visible to everyone) or Private (visible


only to you and collaborators).

4. Optionally, you can initialize the repository with a README file, a .gitignore file,
and a license.

5. Click on the Create repository button.

4.2.3 Step 3: Clone the Repository to Your Local Machine

To work with the repository on your local machine, you need to clone it. Follow these
steps:

1. On the repository page, click on the Code button.

2. Copy the URL provided under the HTTPS or SSH tab.

3. Open a terminal or command prompt on your local machine.

4. Navigate to the directory where you want to clone the repository.

5. Run the following command to clone the repository:


4.2. SETTING UP A REPOSITORY ON GITHUB 18

git clone <repository-url>

Replace <repository-url> with the URL you copied from GitHub.

6. Press Enter. The repository will be cloned to your local machine.

4.2.4 Step 4: Make Changes and Commit Them

After cloning the repository, you can start making changes to the files. Follow these
steps to commit your changes:

1. Navigate to the cloned repository directory on your local machine.

2. Make the necessary changes to the files (e.g., edit, add, or delete files).

3. Stage the changes using the following command:

git add .

This stages all changes. You can also stage specific files by replacing the dot
with the file name.

4. Commit the changes with a message describing what you did:

git commit -m "Your commit message here"

5. Push the changes to the remote repository on GitHub:

git push origin main

Replace main with the name of your default branch if it is different.


4.2. SETTING UP A REPOSITORY ON GITHUB 19

4.2.5 Step 5: Collaborate and Manage Your Repository

GitHub allows you to collaborate with others and manage your repository effectively.
Here are some additional tips:

• Invite Collaborators: Go to the repository settings and add collaborators who


can contribute to the repository.

• Create Branches: Use branches to work on new features or fixes without


affecting the main branch. Create a new branch using:

git checkout -b <branch-name>

• Pull Requests: When you are ready to merge changes from a branch into the
main branch, create a pull request on GitHub.

• Issues: Use the Issues tab to track bugs, enhancements, and tasks related to
your project.

4.2.6 Conclusion

Setting up a repository on GitHub is a straightforward process that enables you to


manage your code effectively and collaborate with others. By following these steps,
you can create, clone, and manage your GitHub repository with ease.
CHAPTER 5

VERSION CONTROL

5.1 Activity 2: Version Control

• You will practice branching, merging, and resolving conflicts in Git.

• Example: Create a feature branch, make changes, and merge into the main
branch.

5.2 Version Control Best Practices for GitHub

Version control is a crucial aspect of software development, enabling collaboration,


tracking changes, and maintaining code integrity. This section outlines best practices
for using GitHub effectively in academic and professional projects.

5.2.1 Setting Up a Repository

• Use meaningful repository names that reflect the project purpose.

• Initialise the repository with a README.md to provide an overview.

• Add a .gitignore file to exclude unnecessary files (e.g., compiled binaries,


IDE metadata).

• Set an appropriate license using the LICENSE file.

5.2.2 Branching Strategy

• Use the main branch for stable, production-ready code.

20
5.2. VERSION CONTROL BEST PRACTICES FOR GITHUB 21

• Create feature branches for new functionalities (e.g., feature/authentication).

• Maintain a develop branch for integrating features before merging into main.

• Delete merged branches to keep the repository clean.

5.2.3 Commit Guidelines

• Write clear, concise commit messages using the imperative mood (e.g., ”Fix
bug in user authentication”).

• Group related changes into a single commit rather than many small ones.

• Use atomic commits to ensure each commit represents a single logical change.

• Avoid committing large files or sensitive data.

5.2.4 Collaboration and Code Review

• Use pull requests (PRs) for code integration and review before merging
changes.

• Assign reviewers to PRs to ensure quality checks.

• Write detailed descriptions in PRs, explaining the changes and motivations.

• Resolve conflicts locally before pushing changes.

5.2.5 Maintaining Repository Health

• Regularly pull the latest changes from the remote repository.

• Use descriptive tags for important releases (e.g., v1.0.0).

• Keep documentation up to date with project changes.

• Automate testing and deployment using GitHub Actions where applicable.

Following these best practices ensures an organised, efficient, and maintainable


workflow when using GitHub for version control.
CHAPTER 6

VERSION CONTROL - PRACTICE

Below as some more detailed steps that you can follow:

6.1 Version Control Best Practices for GitHub

This section outlines best practices for using GitHub effectively in academic and
professional projects.

6.1.1 Setting Up a Repository

• Use meaningful repository names that reflect the project purpose.

• Initialise the repository with a README.md to provide an overview.

• Add a .gitignore file to exclude unnecessary files (e.g., compiled binaries,


IDE metadata).

• Set an appropriate license using the LICENSE file.

6.1.2 Branching Strategy

• Use the main branch for stable, production-ready code.

• Create feature branches for new functionalities (e.g., feature/authentication).

• Maintain a develop branch for integrating features before merging into main.

• Delete merged branches to keep the repository clean.

22
6.2. STEP-BY-STEP GUIDE TO USING GITHUB EFFECTIVELY 23

6.1.3 Commit Guidelines

• Write clear, concise commit messages using the imperative mood (e.g., ”Fix
bug in user authentication”).

• Group related changes into a single commit rather than many small ones.

• Use atomic commits to ensure each commit represents a single logical change.

• Avoid committing large files or sensitive data.

6.1.4 Collaboration and Code Review

• Use pull requests (PRs) for code integration and review before merging
changes.

• Assign reviewers to PRs to ensure quality checks.

• Write detailed descriptions in PRs, explaining the changes and motivations.

• Resolve conflicts locally before pushing changes.

6.1.5 Maintaining Repository Health

• Regularly pull the latest changes from the remote repository.

• Use descriptive tags for important releases (e.g., v1.0.0).

• Keep documentation up to date with project changes.

• Automate testing and deployment using GitHub Actions where applicable.

6.2 Step-by-Step Guide to Using GitHub Effectively

6.2.1 Step 1: Set Up Git and GitHub

1. Install Git on your system (if not already installed).

2. Configure Git with your name and email:


6.2. STEP-BY-STEP GUIDE TO USING GITHUB EFFECTIVELY 24

git config --global user.name "Your Name"


git config --global user.email "[email protected]"

3. Create a GitHub account if you don’t have one.

6.2.2 Step 2: Create a Repository

1. Navigate to https://github.com and create a new repository.

2. Choose whether to make it public or private.

3. Initialise it with a README.md and a .gitignore file.

6.2.3 Step 3: Clone the Repository

1. Copy the repository URL from GitHub.

2. In your terminal or command prompt, run:

git clone https://github.com/your-username/your-repo.git

3. Change to the project directory:

cd your-repo

6.2.4 Step 4: Make and Track Changes

1. Create or modify files in your project.

2. Use git status to check for changes:

git status
6.2. STEP-BY-STEP GUIDE TO USING GITHUB EFFECTIVELY 25

3. Stage your changes:

git add .

4. Commit the changes with a meaningful message:

git commit -m "Added a new feature"

6.2.5 Step 5: Push Changes to GitHub

git push origin main

6.2.6 Step 6: Work with Branches

1. Create a new branch for a feature or bug fix:

git checkout -b feature-branch

2. Make changes, commit them, and push the branch:

git push origin feature-branch

3. Open a pull request on GitHub to merge changes into main.

6.2.7 Step 7: Keep Your Repository Updated

git pull origin main


git rebase main
6.2. STEP-BY-STEP GUIDE TO USING GITHUB EFFECTIVELY 26

6.2.8 Step 8: Resolve Conflicts (If Any)

1. If there are conflicts, Git will mark them in the affected files.

2. Manually edit the files to resolve conflicts.

3. Stage and commit the resolved files:

git add .
git commit -m "Resolved merge conflicts"

4. Push changes and merge the branch.

6.2.9 Step 9: Collaborate Using Pull Requests

1. Use pull requests (PRs) to suggest and review changes.

2. Assign reviewers to check your code before merging.

3. Merge PRs only after they are reviewed and approved.

6.2.10 Step 10: Automate and Maintain Repository

1. Set up GitHub Actions for automated testing and deployment.

2. Use Git tags to mark important versions:

git tag -a v1.0.0 -m "Version 1.0.0"


git push origin v1.0.0

3. Keep your documentation updated.

You might also like