On Campus UNSTPB
Welcome to the
Git & GitHub
Workshop!
Today’s agenda:
1. Git - Introduction and basic commands
by Goanta Rares
Learn how to install Git, navigate Git Bash, and use basic commands
along with creating branches and merging changes.
2. GitHub - Contribute and Collaborate
by Marinescu Teodor
Discover how to create and clone repositories, collaborate by pushing
changes, fork repositories, create pull requests, and manage contributions
from a maintainer's perspective.
3. Q&A and Networking
On Campus UNSTPB
Part 1: Git
What is Git?
● Git is officially defined as a distributed version control
system (VCS).
● It's a system that tracks changes to our project files
over time
● It is used to efficiently work together and collaborate
on team projects
How about GitHub?
● GitHub is a hosting platform for Git
repositories
● Using GitHub, we can upload a local project
repository to a remote cloud-based GitHub
Repository
● GitHub is also a popular way developers for
developers to publish their portfolio online
Useful navigation commands
in the command-line interface
● mkdir – creates directory
● touch - creates file
● cd – changes directory
● rm – removes directory
Setup instructions
● Install git on your computers. Go to
https://git-scm.com/downloads
● After installing it, start your terminal
and type the following command:
git --version
Configuring
● git config --global user.name "Your
Name"
● git config --global user.email
your@email.com
● not used to log in anywhere, used to
track who made what changes
● A Git repository is a container for a project that is tracked by Git
○ Local repository = an isolated repository stored on your own computer
○ Remote repository = generally stored outside of your isolated local system,
usually on a remote server; useful for working in teams
● Initializing a repository (git init)
○ If you want to use git to track the changes in a folder you have to initialize it first
● Checking the status (git status)
○ used to check changes and tracked/untracked files
Repositories
git add
● Adds files to the staging area, which allows git to
track those files
● syntax:
○ git add file.js – one file
○ git add file.js file2.js file3.js – multiple files
○ git add . – all the files and folders
● Checking the status (git status)
○ used to check changes and
tracked/untracked files
git commit
● Saves a snapshot of your code at a particular
time
● syntax:
○ git commit -m „Commit message”
git log
● used to see the commit history
git checkout
● Used to go to a previous state of your code that you
commited
○ syntax: git checkout <commit-hash>
○ You can see the commit hashes when you use git log
● To go back you can use:
○ git checkout master
● Individual timelines of our project commits, where versions of our
project code can exist and be tracked in parallel
○ git branch - lists the branches
○ git branch <new-branch-name> - creates a new branch
● Changing branches:
○ git checkout <branch-name> (hence the git checkout
master from before)
Branches
● Used to implement the code changes that you
made in an individual branch to a different
branch (usually on master)
○ syntax:
git merge <branch-name>
● Deleting branches
○ syntax:
git branch -d <branch-name>
Merging branches (git merge)
Part 2: GitHub
Step-by-step Guide to Collaboration and Advanced
GitHub Features
Create a GitHub
account if you don’t
already have one
Send us your GitHub
usernames
ⓘ
Click Present with Slido or install our Chrome extension to activate
this poll while presenting.
Step 1: Create a GitHub Repository
● Log in: Go to GitHub and log into your account.
● New Repository: Click the + icon (top-right) New repository.
→
● Name: Enter a name for your repository.
● Visibility: Choose Public (anyone can see) or Private (restricted access).
● Optional: Add a description, README, .gitignore, or license.
● Create: Click Create repository.
● Push Code (Optional): Use the commands provided to push your local
code.
Step 2: Add Collaborators
● Go to your repository → Settings
● Click Manage access → Invite a collaborator
● Enter their GitHub username or email → Add
● Collaborator accepts the invitation. Done!
Step 3: Clone the Repository
1. Copy the repository URL (HTTPS, SSH, or GitHub
CLI).
2. Open your terminal.
3. Run: git clone <repo-ulr>
4. Navigate to the cloned repository folder.
cd repo-name
Step 4: Create Your Own Branch
1. Run the command:
git branch <branch-name>
2. Switch to your branch:
git checkout <branch-name>/git switch <branch-name>
3. Verify the branch:
git branch
4. Push the branch:
git push -u origin <branch-name>
Step 5: Stash Changes
• Save your work
– git stash
• Come back later
– git stash pop
• See what’s saved
– git stash list
Step 6: Push Changes
● Create a new file and add content.
○ git add <file-name> / git add . (all)
○ git restore --staged <file-name> / .(all)
● Commit:
○ git commit -m "message"
● Push changes:
○ git push origin <branch-name>
Step 7: Pull Request and Merge
1. Go to the GitHub repository.
2. Click on 'Pull Requests' and select 'New Pull Request'.
3. Compare changes and select your branch.
4. Add a description and click 'Create Pull Request'.
5. Merge the request after review.
Step 8: Fork a Repository
1. Go to the repository you want to fork.
2. Click the 'Fork' button on the top right.
3. Choose your account to fork the repository.
4. Clone the forked repository and start
contributing.
OVERVIEW
3 scenarios
Scenario 1: Working Solo on Your Own Projects
(I really don’t know what’s wrong with the indents on these slides. They look fine on PowerPoint
and Google Slides, but they get messed up when uploaded here)
1. Create a directory on your computer:
mkdir <project-directory>
cd <project-directory>
2. Initialize a local repository:
git init
3. Create a GitHub repository and connect it as the remote origin:
git remote add origin <repo-url>
4. Make changes to your files and track them:
git add .
git commit -m "Describe changes"
5. Push changes to GitHub:
git push -u origin master
Your project is now on GitHub, and you can track its progress and share it with others if
needed.
Scenario 2: Collaborating with Friends
Repository Owner:
Add collaborators on GitHub: Navigate to Settings > Access > Collaborators > Add People
Collaborators:
Clone the repository:
git clone <repo-url>
Everyone:
Create and switch to your own branch:
git branch <branch-name>
git checkout <branch-name>
Make changes, stage, and commit:
git add .
git commit -m "Describe changes"
Push your branch to GitHub:
git push -u origin <branch-name>
Open a pull request on GitHub:
Go to Pull Requests > Compare & pull request
Select your branch to compare with the main branch.
Resolve conflicts (if any) and merge the pull request.
Useful VS Code extensions:
Git Graph: Visualize commit history
and branch structure.
GitHub Pull Requests: Manage PRs
and resolve conflicts in VS Code.
GitLens: View file history,
authorship, and commit details.
Scenario 3: Collaborating to a larger project
(where you are not collaborator)
1. Fork the repository:
Click the Fork button in the top-right corner of the repository on GitHub.
2. Clone your forked repository:
git clone <your-fork-url>
3. Create and switch to a new branch:
git branch <branch-name>
git checkout <branch-name>
4. Make changes, stage, and commit:
git add .
git commit -m "Describe changes"
5. Push changes to your fork:
git push origin <branch-name>
6. Open a pull request:
Go to the original repository on GitHub.
Navigate to Pull Requests > Compare & pull request
Select your branch from your fork and propose it for the base branch of the original repository.
*extra Teo stuff from work idk
ⓘ
Click Present with Slido or install our Chrome extension to show live
Q&A while presenting.
Q&A (we forgot to show this part)

Git and GitHub workshop of GDG on Campus UNSTPB

  • 1.
    On Campus UNSTPB Welcometo the Git & GitHub Workshop!
  • 2.
    Today’s agenda: 1. Git- Introduction and basic commands by Goanta Rares Learn how to install Git, navigate Git Bash, and use basic commands along with creating branches and merging changes. 2. GitHub - Contribute and Collaborate by Marinescu Teodor Discover how to create and clone repositories, collaborate by pushing changes, fork repositories, create pull requests, and manage contributions from a maintainer's perspective. 3. Q&A and Networking On Campus UNSTPB
  • 3.
  • 4.
    What is Git? ●Git is officially defined as a distributed version control system (VCS). ● It's a system that tracks changes to our project files over time ● It is used to efficiently work together and collaborate on team projects
  • 5.
    How about GitHub? ●GitHub is a hosting platform for Git repositories ● Using GitHub, we can upload a local project repository to a remote cloud-based GitHub Repository ● GitHub is also a popular way developers for developers to publish their portfolio online
  • 6.
    Useful navigation commands inthe command-line interface ● mkdir – creates directory ● touch - creates file ● cd – changes directory ● rm – removes directory
  • 7.
    Setup instructions ● Installgit on your computers. Go to https://git-scm.com/downloads ● After installing it, start your terminal and type the following command: git --version Configuring ● git config --global user.name "Your Name" ● git config --global user.email [email protected] ● not used to log in anywhere, used to track who made what changes
  • 8.
    ● A Gitrepository is a container for a project that is tracked by Git ○ Local repository = an isolated repository stored on your own computer ○ Remote repository = generally stored outside of your isolated local system, usually on a remote server; useful for working in teams ● Initializing a repository (git init) ○ If you want to use git to track the changes in a folder you have to initialize it first ● Checking the status (git status) ○ used to check changes and tracked/untracked files Repositories
  • 9.
    git add ● Addsfiles to the staging area, which allows git to track those files ● syntax: ○ git add file.js – one file ○ git add file.js file2.js file3.js – multiple files ○ git add . – all the files and folders ● Checking the status (git status) ○ used to check changes and tracked/untracked files git commit ● Saves a snapshot of your code at a particular time ● syntax: ○ git commit -m „Commit message”
  • 10.
    git log ● usedto see the commit history git checkout ● Used to go to a previous state of your code that you commited ○ syntax: git checkout <commit-hash> ○ You can see the commit hashes when you use git log ● To go back you can use: ○ git checkout master
  • 11.
    ● Individual timelinesof our project commits, where versions of our project code can exist and be tracked in parallel ○ git branch - lists the branches ○ git branch <new-branch-name> - creates a new branch ● Changing branches: ○ git checkout <branch-name> (hence the git checkout master from before) Branches
  • 12.
    ● Used toimplement the code changes that you made in an individual branch to a different branch (usually on master) ○ syntax: git merge <branch-name> ● Deleting branches ○ syntax: git branch -d <branch-name> Merging branches (git merge)
  • 13.
    Part 2: GitHub Step-by-stepGuide to Collaboration and Advanced GitHub Features
  • 14.
    Create a GitHub accountif you don’t already have one
  • 15.
    Send us yourGitHub usernames ⓘ Click Present with Slido or install our Chrome extension to activate this poll while presenting.
  • 16.
    Step 1: Createa GitHub Repository ● Log in: Go to GitHub and log into your account. ● New Repository: Click the + icon (top-right) New repository. → ● Name: Enter a name for your repository. ● Visibility: Choose Public (anyone can see) or Private (restricted access). ● Optional: Add a description, README, .gitignore, or license. ● Create: Click Create repository. ● Push Code (Optional): Use the commands provided to push your local code.
  • 17.
    Step 2: AddCollaborators ● Go to your repository → Settings ● Click Manage access → Invite a collaborator ● Enter their GitHub username or email → Add ● Collaborator accepts the invitation. Done!
  • 18.
    Step 3: Clonethe Repository 1. Copy the repository URL (HTTPS, SSH, or GitHub CLI). 2. Open your terminal. 3. Run: git clone <repo-ulr> 4. Navigate to the cloned repository folder. cd repo-name
  • 19.
    Step 4: CreateYour Own Branch 1. Run the command: git branch <branch-name> 2. Switch to your branch: git checkout <branch-name>/git switch <branch-name> 3. Verify the branch: git branch 4. Push the branch: git push -u origin <branch-name>
  • 20.
    Step 5: StashChanges • Save your work – git stash • Come back later – git stash pop • See what’s saved – git stash list
  • 21.
    Step 6: PushChanges ● Create a new file and add content. ○ git add <file-name> / git add . (all) ○ git restore --staged <file-name> / .(all) ● Commit: ○ git commit -m "message" ● Push changes: ○ git push origin <branch-name>
  • 22.
    Step 7: PullRequest and Merge 1. Go to the GitHub repository. 2. Click on 'Pull Requests' and select 'New Pull Request'. 3. Compare changes and select your branch. 4. Add a description and click 'Create Pull Request'. 5. Merge the request after review.
  • 23.
    Step 8: Forka Repository 1. Go to the repository you want to fork. 2. Click the 'Fork' button on the top right. 3. Choose your account to fork the repository. 4. Clone the forked repository and start contributing.
  • 24.
  • 25.
    Scenario 1: WorkingSolo on Your Own Projects (I really don’t know what’s wrong with the indents on these slides. They look fine on PowerPoint and Google Slides, but they get messed up when uploaded here) 1. Create a directory on your computer: mkdir <project-directory> cd <project-directory> 2. Initialize a local repository: git init 3. Create a GitHub repository and connect it as the remote origin: git remote add origin <repo-url> 4. Make changes to your files and track them: git add . git commit -m "Describe changes" 5. Push changes to GitHub: git push -u origin master Your project is now on GitHub, and you can track its progress and share it with others if needed.
  • 26.
    Scenario 2: Collaboratingwith Friends Repository Owner: Add collaborators on GitHub: Navigate to Settings > Access > Collaborators > Add People Collaborators: Clone the repository: git clone <repo-url> Everyone: Create and switch to your own branch: git branch <branch-name> git checkout <branch-name> Make changes, stage, and commit: git add . git commit -m "Describe changes" Push your branch to GitHub: git push -u origin <branch-name> Open a pull request on GitHub: Go to Pull Requests > Compare & pull request Select your branch to compare with the main branch. Resolve conflicts (if any) and merge the pull request. Useful VS Code extensions: Git Graph: Visualize commit history and branch structure. GitHub Pull Requests: Manage PRs and resolve conflicts in VS Code. GitLens: View file history, authorship, and commit details.
  • 27.
    Scenario 3: Collaboratingto a larger project (where you are not collaborator) 1. Fork the repository: Click the Fork button in the top-right corner of the repository on GitHub. 2. Clone your forked repository: git clone <your-fork-url> 3. Create and switch to a new branch: git branch <branch-name> git checkout <branch-name> 4. Make changes, stage, and commit: git add . git commit -m "Describe changes" 5. Push changes to your fork: git push origin <branch-name> 6. Open a pull request: Go to the original repository on GitHub. Navigate to Pull Requests > Compare & pull request Select your branch from your fork and propose it for the base branch of the original repository.
  • 28.
    *extra Teo stufffrom work idk
  • 29.
    ⓘ Click Present withSlido or install our Chrome extension to show live Q&A while presenting. Q&A (we forgot to show this part)

Editor's Notes

  • #15 📣 This is Slido interaction slide, please don't delete it. ✅ Click on 'Present with Slido' and the poll will launch automatically when you get to this slide.
  • #29 📣 This is Slido interaction slide, please don't delete it. ✅ Click on 'Present with Slido' and the questions from your audience will appear when you get to this slide.