0% found this document useful (0 votes)
45 views38 pages

GitHub Basics for Version Control

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)
45 views38 pages

GitHub Basics for Version Control

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
You are on page 1/ 38

Database Development with PL/SQL INSY

8311

Instructor:
▪ Eric Maniraguha | [email protected] | LinkedIn Profile

6h00 pm – 9h50 pm
▪ Monday A -G207
▪ Tuesday B-G204
▪ Wednesday E-G207 January 2024
▪ Thursday F-G307 1
GitHub: Where your
code meets its social
network!

2
GitHub

Reference reading
▪ YouTube Tutorial: Git Tutorial for Beginners: Learn Git in 1 Hour
▪ GitHub and Git Tutorial for Beginners
▪ Introduction to GitHub
▪ Intro to GitHub for version control
▪ DevOps Tools Mapping
▪ How to Design an Attractive GitHub Profile Readme…
▪ YouTube Tutorial: How to create Professional Github Readme Profile (Step By Step)
▪ Getting Started with R Markdown
▪ YouTube Tutorial: Git Merge Conflicts | How Merge Conflicts Happen | How to resolve
Merge Conflicts | Merge Conflict
▪ Git & GitHub

Lecture 02 – Introduction to GitHub 3


Introduction

Course
Overview This course is designed to introduce students
to GitHub, a powerful platform for version
control and collaboration. Students will
learn the basics of using GitHub, including
creating repositories, committing
changes, branching, merging, and
collaborating with others. By the end of
the course, students will be comfortable using
GitHub for their projects.

4
5
What You’ll Learn

Version Control Repositories & Project Advanced


Collaboration Best Practices
Basics Branching Management Techniques

Leverage GitHub
Collaborate on Learn how to fork
Understand Git Create and tools like Issues,
projects using pull repositories and Write effective
and how it powers manage Labels, and
requests and contribute to open README files.
GitHub. repositories. Projects to
reviews. source.
organize tasks.

Use branches to
Track changes, Maintain clean
work on new Use Actions for Implement team
revert code, and Resolve conflicts code and
features without automated workflows and
create meaningful effectively. meaningful
affecting the main workflows. CI/CD pipelines.
commit histories. commit messages.
project.

6
▪ Developers and data scientists seeking collaboration skills.
▪ Students working on team projects.
▪ Professionals aiming to enhance productivity and code management.

Requirements:
▪ Basic knowledge of programming.
▪ A GitHub account.

7
Basic GitHub Terms
Repository (Repo):
A storage location for your project files, similar to a folder, where all the code, resources, and version history for your project are kept.
Branch:
A version of the repository used to develop new features without affecting the main (default) codebase.
Commit:
A snapshot of your changes in the repository, like saving progress with a message describing what was changed.
Push:
Sending your committed changes from your local repository to the remote repository on GitHub.
Pull:
Fetching and merging changes from the remote repository to your local repository.
Pull Request (PR):
A request to merge changes from one branch to another, often used for code review and collaboration.
Fork:
A personal copy of someone else's repository, allowing you to experiment or contribute to their project without affecting the original repository.
Clone:
Creating a copy of a GitHub repository on your local computer.

8
Basic GitHub Terms

Repository (Repo):
A storage location for your project files, similar to a folder, where all the code,
resources, and version history for your project are kept.
Branch:
A version of the repository used to develop new features without affecting the
main (default) codebase.
Commit:
A snapshot of your changes in the repository, like saving progress with a
message describing what was changed.
Push:
Sending your committed changes from your local repository to the remote
repository on GitHub.
Pull:
Fetching and merging changes from the remote repository to your local
repository.
Pull Request (PR):
A request to merge changes from one branch to another, often used for code
review and collaboration.
Fork: Source Image: https://medium.com/@derya.cortuk/git-terminology-101-366db34f1f4f
A personal copy of someone else's repository, allowing you to experiment or
contribute to their project without affecting the original repository.
Clone:
Creating a copy of a GitHub repository on your local computer.
9
Git and Command Line Terms
Terminal or Command Line (CLI):
An interface for entering text commands to interact with your computer or GitHub.
CLI (Command Line Interface):
A text-based interface used to execute Git commands like git add, git commit, and git
push.
Directory:
A folder in your file system where your project files are stored.

Working Directory:
The directory on your computer where your repository files are currently located.
Staging Area:
A temporary area where changes are stored before committing them to the
repository.
Merge:
Combining changes from different branches into a single branch.

HEAD:
Refers to the current branch you are working on in your repository.

Source Image: https://medium.com/@kittipat_1413/git-and-command-line-101-essential-skills-for-software-engineers-7a35b489bf36


10
GitHub Features
Feature Description Use Case
Repository (Repo) Storage for project files, code, and version history. Personal projects, team collaboration, or open-source contributions.

Branches Parallel versions of a repository for development or testing. Work on features independently without affecting the main branch.

Pull Requests (PRs) Propose changes from one branch to another for review. Collaboration, code review, and merging changes.

Issues Tracks bugs, feature requests, and tasks. Bug reporting, task management, and feature planning.

GitHub Actions Automates workflows like CI/CD, testing, and deployments. Automatically run tests, build code, or deploy applications.

GitHub Pages Hosts static websites directly from a repository. Create project documentation, personal portfolios, or simple websites.

Wiki Documentation space for project guides and instructions. Maintain detailed project explanations and collaboration instructions.

Projects Kanban-style boards to visually track tasks and progress. Organize tasks for teams using Issues and Pull Requests.

Labels Tags to categorize Issues and Pull Requests. Mark tasks as bug, enhancement, or help wanted for better organization.

Group related Issues and Pull Requests around specific goals or


Milestones Track progress towards completing a feature or project phase.
deadlines.

Discussions Open-ended forum-like conversations in a repository. Community-driven brainstorming or general queries.


11
Forking Copies someone else’s repository into your account. Experiment with changes or contribute to open-source projects.
GitHub Features
Feature Description Use Case
Notifications Alerts for repository activities like Issues and Pull Requests. Stay updated on changes or discussions in your repositories.

GitHub Marketplace Tools and integrations to enhance workflows. CI/CD tools, security scans, and project management plugins.

Security Features Tools like Dependabot and code scanning to ensure code safety. Identify and fix vulnerabilities in the codebase.

Gists Simple sharing of code snippets or text. Share small code samples, notes, or configurations.

Collaborators Add people to your repository with controlled access permissions. Invite team members to contribute directly to private projects.

Insights Analytics about code activity, contributors, and project history. Monitor code frequency, contributor activity, and Pull Request timelines.

Trigger notifications, deployments, or actions when changes occur in the


Webhooks Send real-time updates to external applications.
repository.

GitHub Codespaces Cloud-based, pre-configured development environments. Start coding immediately without needing local setup.

12
Version Control Terms

Version Control Terms

Version Control System (VCS):

A system that tracks changes to files over time, allowing you to recall specific versions later.

Distributed VCS:

A system like Git that allows multiple developers to work on the same codebase independently.

Remote Repository:

A repository hosted on GitHub or another platform, accessible to collaborators online.

Local Repository:

A repository stored on your computer.

Conflict:

A situation where changes from different branches or contributors overlap and need manual resolution.

13
Unlocking Git: Understanding Commands
Through Diagrams

Image Source: https://cloudstudio.com.au/2021/06/26/git-command/


Image Source: https://programming.earthonline.us/you-can-master-git-git-commands-
with-these-diagrams-40a0b2f5cc42

1 2 14
How to get started
Please register on the GitHub website.

▪ On your computer, you need to install Git first. The process will depend on your operating system: please follow the instructions below by clicking the relevant button.

How To Install Git Bash On Windows

15
The basic commands include
Basic Commands initializing the Git repository,
saving changes, checking logs,
pushing the changes to the
remote server, and merging.

16
Command Description
git init Create a Git repository in a local directory.

git clone <url> Copy the entire repository from a remote server to a local directory. Can also clone local repositories.

git add <file.txt> Add a single file or multiple files and folders to the staging area.

git commit -m "Message" Create a snapshot of changes and save it in the repository.

git config Set user-specific configurations like email, username, and file format.

git status Show the list of changed files or files that have yet to be staged and committed.

git push <remote-name> <branch-name> Send local commits to the remote branch of the repository.

git checkout -b <branch-name> Create a new branch and switch to it.

git remote -v View all remote repositories.

git remote add <remote-name> <host-or-remoteURL> Add a remote server to the local repository.

git branch -d <branch-name> Delete a branch.

git pull Merge commits from a remote repository into a local directory.

git merge <branch-name> After resolving merge conflicts, blend the selected branch into the current branch.
17
git log Show a detailed list of commits for the current branch.
Mastering Markdown for GitHub
What is Markdown?
Why Learn Efficiency: Quick and simple syntax.
▪ A lightweight maarkup language to format plain text. Markdown?
▪ Used for documentation, README files, and wikis on GitHub. Versatility: Powers README files, GitHub Pages, and wikis.

Key Markdown Syntax Collaboration: Clear formatting for team projects.

Element Syntax Example Output Practice Tip


Headings # H1 ## H2 ... ###### H6 # Heading 1, ## Heading 2
Use GitHub’s Preview feature while editing Markdown to see live
Bold **text** text formatting.
Italic *text* text
Lists - Item (unordered) or 1. Item (ordered) - Item, 1. Item
Links [text](URL) GitHub
Images ![alt](URL)
Code `code` or triple backticks code block
Tables Use ` and---`

Vs code Google Docs to Markdown GitHub Page Slack 18


Example Markdown for GitHub

Results after Markdown text

Markdown text 19
What is a GitHub User Profile?
A GitHub user profile is a public page that represents a user's identity on GitHub. It shows information about the user, their
repositories, contributions, and activities.

Profile Picture and Bio Profile Picture: A photo or avatar to represent the user (optional).
Bio: A short description about the user, such as their role, interests, or expertise.
Pinned Repositories Highlight important repositories the user wants to showcase, such as personal projects or open-source
contributions.

Contribution Graph A heatmap showing the user's contributions (commits, pull requests, issues) over the past year.

Repositories A list of all public repositories owned by the user, including the name, description, and programming languages
used.

Followers and Following Followers: People who are subscribed to the user's updates.
Following: Other GitHub users the profile owner is following.
Activity Feed Displays recent activities such as commits, pull requests, and discussions.

GitHub README Profile A custom section created by adding a README.md file in a repository named after the user’s username.
(Optional)
This can include skills, achievements, current projects, or links to portfolios.
Organizations Lists any organizations the user is a part of on GitHub.

Stars A collection of repositories the user has liked or "starred."

Gists A list of code snippets or text files the user has shared publicly or privately.
Source Image: Profile readme

20
How to Enhance Your GitHub Profile
Use a Profile README: Create a repository named after your username (e.g., username/username) and add a README.md file with
personalized content.

Customize Your Bio: Include links to your portfolio, LinkedIn, or website. Use emojis and markdown for a visually appealing bio.

Pin Repositories Strategically: Highlight projects that showcase your skills and achievements.

Stay Active: Regularly contribute to repositories, create new projects, or maintain existing ones.

Engage with the Community: Participate in discussions, report issues, or contribute to other repositories.

A GitHub profile acts as a professional portfolio that demonstrates your skills and contributions, making it valuable for recruiters,
collaborators, and the developer community.

21
GitHub User Profile
Adding a profile README
In the upper-right corner of any page, select + , then
click New repository.

22
Removing a profile README

The profile README will be removed from your GitHub profile if any of the following apply:

▪ The README file is removed or made empty.


▪ The repository is made private.
▪ The repository name no longer matches your username due to a change in either or both names.

The method you choose depends upon your needs, but if you're unsure, we recommend making your
repository private. For steps on how to make your repository private, see " Setting repository visibility."

23
Step I. Create your own repository

1. Create your own repository and project folder structure

Think of a repository (or repo) as the "main folder"


for a project, where everything related to that project
is stored. A repo can contain multiple folders or
individual files, all organized under one project.

You'll maintain both a local copy (on your computer)


and an online copy (on GitHub) of all the files in your
repository.

The typical GitHub workflow is captured by the


phrase "commit-pull-push.

24
Step II. Create your own repository

Here's a concise version for a PowerPoint slide:

Initialize Repo:
▪ Create a README.md for project details, purpose,
and licensing.
Markdown Format:
▪ Use .md for structured project documentation.
.gitignore File:
▪ Exclude unnecessary files from the repo.
Language Template:
▪ Select the relevant template (e.g., R) in the
.gitignore.

25
Created Repository

After creating my-first-repository, I can push my code from


local repository to remote repository

26
Repository is created

Explanation:

▪ echo "# my-first-repository" >> README.md: This creates a new README.md file with a simple
title inside it.
▪ git init: Initializes a new Git repository in your current directory.
▪ git add README.md: Stages the README.md file for committing.
▪ git commit -m "first commit": Commits the staged file with the message "first commit."
▪ git branch -M main: Renames the current branch to main.
▪ git remote add origin <url>: Links the local repository to a remote GitHub repository.
▪ git push -u origin main: Pushes the code from the local main branch to the remote main branch and
sets up tracking between the two.

Use case: This method is useful when you're starting from scratch and want to create a new Git
repository, initialize it, and then push it to GitHub.

Explanation:

▪ git remote add origin <url>: Links the local repository to the remote GitHub repository.
▪ git branch -M main: Renames the branch to main (if it hasn't been done already).
▪ git push -u origin main: Pushes the local branch to the remote repository and sets up the tracking.

Use case: This method assumes that you've already initialized a Git repository, committed your changes,
and just want to push an existing repository to GitHub.

27
Why “.gitignore”?
The .gitignore file is essential because it tells Git which files or directories to ignore in a project.

This helps to:

▪ Keep Repositories Clean: Exclude unnecessary files (e.g., temporary files, build artifacts) from being tracked by Git.
▪ Protect Sensitive Information: Prevent sensitive data (e.g., API keys, passwords) from being accidentally committed.
▪ Optimize Collaboration: Ensure that only relevant files are shared among team members, reducing clutter and potential conflicts.
▪ Maintain Efficient Version Control: Focus on tracking and managing only the files that are important to the project.

1. log/*.log.[0-9]
▪ This ignores files in the log/ directory that have the format *.log.[0-9].
▪ For example:
o log/error.log.1
o log/output.log.2
▪ These files are likely log rotation files (e.g., created when logs are rotated to manage size).

2. assests/video/
▪ This ignores everything inside the assests/video/ directory.
▪ All files and subdirectories within assests/video/ will be excluded from Git.

3. !assests/video/iphone_*.mp4
▪ The ! negates the ignore rule, meaning it will include files matching the pattern
assests/video/iphone_*.mp4, even though the assests/video/ directory is ignored.
▪ Only files named like iphone_video.mp4, iphone_clip.mp4, etc., will be tracked by Git.
28
How to create a git repository?
Here is how the repository should look:

29
GIT Push and Pull Tutorial
Note: Create a new repository like the previous slide as the 1st step

2. Open your Git Bash


▪ Git Bash can be downloaded in here, and it is a shell used to interface with the operating system which follows the UNIX command.
3. Create your local project in your desktop directed
towards a current working directory

4. Initialize the git repository

30
GIT Push and Pull Tutorial
5. Add the file to the new local repository 6. Commit the files staged in your local repository
by writing a commit message

31
GIT Push and Pull Tutorial
7. Copy your remote repository's URL from GitHub

▪ The HTTPS or URL is copied from the given GitHub account, which is the place of the remote repository.

8. Add the URL copied, which is your remote repository to where your local content from your
repository is pushed

git remote add origin 'your_url_name'

32
GIT Push and Pull Tutorial
9. Push the code in your local repository to GitHub

▪ git push -u origin master is used for pushing local content to GitHub.
▪ In the code, the origin is your default remote repository name and '-u' flag is
upstream, which is equivalent to '-set-upstream.' and the master is the branch,
name.upstream is the repository that we have cloned the project.
▪ Fill in your GitHub username and password.

33
Git Push and Pull Tutorial
10. View your files in your repository hosted on GitHub

▪ You can finally see the file hosted on GitHub.

34
Challenge Yourself!

Elevate Your GitHub Expertise: Master Branching, Collaboration, and Conflict Resolution

Enhance Code
Integration: Improve your
skills in integrating code
Resolve Conflicts: from various sources to
maintain a cohesive and
Master conflict resolution high-quality project.
techniques to handle and
Form Groups: merge conflicting changes
Learn how to organize and smoothly.
collaborate within groups on
Manage Team Projects: GitHub.
Understand how to set up
and manage team projects
Create Branches: for collaborative
Learn how to create and development.
manage branches to work
on different features or fixes
simultaneously.

35
Career Opportunities with GitHub Skills: Unlocking Roles in
Development, Data, and More

Open Source Contributor: Many


Software Developer: GitHub is crucial for DevOps Engineer: DevOps roles involve
companies and projects operate in open
version control and collaboration in software managing development, testing, and
source, where GitHub is widely used for
development. Developers use GitHub to deployment pipelines. GitHub plays a central
collaboration. Contributing to open-source
manage code, track changes, and collaborate role in source control, continuous integration
with teams. projects can be a great way to build your
(CI), and deployment automation.
portfolio and network.

Data Scientist/Analyst: GitHub is used to Full-Stack Developer: Both frontend and


Machine Learning Engineer: Version
store code, data, and models in data science backend developers use GitHub to manage
control is critical when developing machine
projects. It's also valuable for collaborating their codebases, ensuring the project is well-
learning models, and GitHub helps manage
with other data professionals on analysis organized and contributions from different
model code, experiments, and collaborations.
projects. team members are easily tracked.

Technical Writer: Writing documentation


Project Manager (Tech): GitHub can be Cloud Engineer: GitHub integrates with
for open-source or internal projects hosted
used for project management, allowing you cloud platforms like AWS, Azure, and Google
on GitHub is a valuable skill. Documentation
to track tasks, bugs, and feature requests Cloud for managing infrastructure as code
helps other developers understand how to
using GitHub issues and project boards. and deploying applications.
use and contribute to projects.

Quality Assurance (QA) Engineer: QA


engineers use GitHub to manage testing
scripts, track bugs, and collaborate on test
automation.
36
Mastering GitHub is a vital Creating and maintaining a
These skills and practices
step in building strong version professional GitHub profile
GitHub empowers seamless provide a solid foundation
control practices. By learning to is equally important. It serves
collaboration and effective for your academic and
manage project versions, track as a portfolio to showcase
project management, professional growth,
changes, and streamline your work, demonstrate
fostering teamwork and equipping you to tackle future
workflows, you've gained your expertise, and build
improving productivity in group challenges with confidence and
essential skills for your credibility in academic,
settings. contribute meaningfully to any
organizing and maintaining professional, or open-source
team or project.
any project efficiently. communities.

37
Keep Learning!

38

You might also like