KEMBAR78
Github Tutorial | PDF | Version Control | System Software
0% found this document useful (0 votes)
4 views7 pages

Github Tutorial

github

Uploaded by

Asma Zerrouki
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)
4 views7 pages

Github Tutorial

github

Uploaded by

Asma Zerrouki
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/ 7

Github Workshop

Dr. Charafeddine Mechalikh 1.3 February 2023


Table of contents

I - Github, Driving Collaborative Software Development 3


1.1 Objectives.................................................................................................................3
1.2 Requirements...........................................................................................................4
1.3 Validation .................................................................................................................4
1.4 Using Github and Git................................................................................................4

2
Github, Driving Collaborative Software
Development I

1.1. Objectives

Fundamental

By the end of the week-long work session, students will have achieved the following objectives:
Understand the role and advantages of version control systems: Students will learn about the
benefits of using version control systems like Git and Github, including the ability to track
changes, collaborate with others, and maintain a history of their code. They will understand
the importance of version control in software development and its impact on the development
process.
Create a professional GitHub account: Students will create a new GitHub account and become
familiar with the GitHub platform as a portfolio for showcasing their work and skills as
developers or UX designers. They will learn about GitHub's key features, including creating
repositories, committing changes, etc. , and how to use them effectively.
Configure repository settings: Students will create a new repository on GitHub and configure
its settings, including adding a description, selecting a license, and choosing a .gitignore file.
They will also learn about licensing and how to add a license to their project repository to help
protect their work and ensure that it is used appropriately.
Learn Git command line interface: Students will download and install Git on their computer
and become familiar with the Git command line interface to manage version control for their
projects. They will learn how to initialize Git in their project folder and link their project with
their repository on GitHub.
Upload a project to GitHub: Students will upload their projects to GitHub, using Git to manage
version control and ensure that changes are saved and tracked over time, making it easier for
potential collaborators to review their work. They will gain experience working on a real project
with a team and develop skills that can be applied to future projects.
Increase visibility: By completing these objectives, students will have not only gained practical
experience using GitHub and Git to manage version control, but they will have also built a
professional online presence, increased their visibility in the developer community, and
potentially even competed on the national ranking. These skills and experiences will help them
stand out to potential employers and collaborators and prepare them for future projects and
opportunities in their career.
Understand the difference between a work in progress code and a release code.
Additionally, the best practices for using version control systems such as Git, instead of
commenting out code during development, will be covered to ensure that students follow
industry-standard best practices. By the end of the session, students will be able to
confidently and effectively collaborate on software projects.

3
Github, Driving Collaborative Software Development

1.2. Requirements

Note

Before starting, below are a set of requirements needed to complete this project:
Access to a computer with internet access.
Basic knowledge of the command line interface (CLI).
A project folder with the files and code for the project they want to upload.
Students will also need to follow the steps carefully and accurately to ensure that their project is
uploaded correctly. Additionally, they should make sure to test the project and ensure that it works as
expected before uploading it to GitHub.

1.3. Validation

Warning

Do not forget to add the following email as a contributor. In order to validate your workshop .
aitt.ukmo@gmail.com1

1.4. Using Github and Git

Step 1: Creating a GitHub Account


1. Go to GitHub's website (https://github.com/).
2. Click on the "Sign up" button in the top-right corner.
3. Enter your desired username, email address, and password.
4. Click on the "Create account" button.
5. Follow the prompts to complete the account creation process.
6. Make sure to create a professional account, with all the required information (name, address,
contact information, etc.).
Step 2: Creating a Repository
1. Log in to your GitHub account.
2. Click on the " + " sign in the top-right corner and select " New repository " from the
dropdown menu.

1. mailto:aitt.ukmo@gmail.com

4
Github, Driving Collaborative Software Development

3. Enter a name for your remote repository.


4. Choose whether you want the repository to be public or private.
5. Optionally, add a description for your repository.
6. Do not add a readme.md file at this step.
Step 3: Downloading Git
1. Go to the Git website (https://git-scm.com/downloads)
2. Choose the appropriate installer for your operating system and download it.
3. Run the installer and follow the prompts to complete the installation process.
Step 4: Moving to the Project Folder
Open a terminal or command prompt on your computer and navigate to the directory where your
project is located.
Step 5: Initializing Git and Linking the Project with the Repository
A. If you are the project creator (the Project was on your machine and you wanted to upload it)
1. Once you are in the project directory, run the command "git init" to initialize your local
repository.
2. Go to the repository page on GitHub.
3. Click on the "Code" button and copy the URL for the repository.
4. In the terminal or command prompt, run the command "git remote add origin
<repository URL>" to link your project with the repository.
5. Now, your team members can pull changes from your remote repository using the "git pull"
command or, if it is the first time clone the project as shown below (Step B).
B. If you are a contributor (Cloning Your Remote Repository, if the project is already on github)
You can clone your remote repository using "git clone <repository URL>", and then perform
your changes.
Step 7: Uploading the Project to GitHub
1. Once your project is ready to be uploaded, add the changes to the staging area using the git
add . command.
2. Commit the changes using the git commit - m "message" command with a meaningful
message describing the changes.
3. Push the changes to the repository using the git push command (you may need git push
-u origin main the first time).
4. Congratulations, your project has now been uploaded to GitHub!

Again, a Summary of the Frequently Used Git Commands Reminder

Git Version
1 git --version

If Git is correctly installed, you will see the version number.


Initializing Git
1 git init

This command will create a new Git repository in the current directory. Once you have initialized the
repository, you can start tracking changes to your files.

5
Github, Driving Collaborative Software Development

Pulling Changes
1 git pull <remote_name> <branch>

This command will pull changes from remote repository to local one.
Adding a remote repository to your local repository.
1 git remote add <remote_name> <repository_URL>

This command will add a remote repository to your local repository. Replace <remote_name> with a
name you choose for the remote repository (usually origin), and <repository_URL> with the
URL of the remote repository you want to link to your local repository.
Pushing Changes (Uploading to Github)
Add file(s) to the staging area.
1 git add <file_name>

This command will add the specified file(s) to the staging area, which prepares the file(s) to be
committed to the repository.
Record changes to the repository with a commit message.
1 git commit -m "commit message"

This command will record your changes to the repository and create a new commit with the specified
commit message. The commit message should describe the changes you have made in a concise and
clear way.
Push committed changes to the remote repository.
1 git push <remote_name> <branch_name>

This command will push the committed changes in your local repository to the remote repository.
Replace <remote_name> with the name of the remote repository you added with the git remote
command (usually origin), and <branch_name> with the name of the branch you want to push to
(usually main or master). Atlhough it is not advisable, you can force pushing using the -f parameter
e.g. "git push -f origin main".
Cloning a Remote Repository
Clone a remote repository to your local machine.
1 git clone <repository_URL>

Replace <repository_URL> with the URL of the remote repository you want to clone. You can find
this URL on the repository page on GitHub.
Show a list of the remote repositories associated with your local repository :
1 git remote -v

This command will show you the URLs of the remote repositories associated with your local repository.
You can use this command to verify that your local repository is correctly linked to the remote
repository.
Pull changes from the remote repository to your local repository
1 git pull <remote_name> <branch_name>

This command will pull changes from the specified branch of the remote repository to your local
repository. Replace <remote_name> with the name of the remote repository (usually origin), and
<branch_name> with the name of the branch you want to pull from (usually main or master).

6
Github, Driving Collaborative Software Development

Learn Best Practices Note

As a note to new developers, it is common to comment out sections of code that are not yet complete
or are causing issues. While this can be a helpful practice it suggests that this work is a "Work in
Progress (WIP)" that should not be published or be included in the final release version.
Commented-out code can make your code more difficult to read and maintain over time, and can
lead to confusion for other developers who may be working on the project in the future. Instead, it is
recommend that to use a version control system such as Git to manage code changes and revisions.
This is the best practice for keeping track of changes and collaborating with other developers, while
ensuring that your code is stable, readable and ready for release.

You might also like