GitHub Guide
GitHub Guide
1 Introduction
GitHub is a widely used platform for version control and collaboration. In this
guide, we will walk through the steps required to set up a GitHub repository for
recording practical sessions in the IT1214 Object-Oriented Programming Design
course. We will learn how to create a GitHub account, set up a repository, and
manage their practical files using Git Bash.
3 Setting Up a Repository
1. After logging in, click on the + icon in the top-right corner and select
New repository.
2. Provide a repository name (e.g., “IT1214-Practicals”).
1
4 Installing Git and Accessing the Repository
1. Download Git from https://git-scm.com/ and install it.
2. Open Git Bash.
3. Configure Git with your credentials:
git config == g l o b a l u s e r . name ”Your Name”
git config == g l o b a l u s e r . e m a i l ” your =email@example . com”
2
7 Accessing the Repository from Another Com-
puter
To continue working on your project from another computer, follow these steps:
1. Cloning a Repository:
g i t c l o n e <r e p o s i t o r y u r l >:
This command c r e a t e s a l o c a l copy o f t h e remote r e p o s i t o r y on your machine .
This l o c a l copy i n c l u d e s a l l f i l e s , d i r e c t o r i e s , and t h e c o m p l e t e v e r s i o n
history .
Make Changes: Modify the files in your working directory. Stage Changes:
g i t add < f i l e o r d i r e c t o r y >: Add t h e m o d i f i e d f i l e s t o t h e s t a g i n g area ,
p r e p a r i n g them f o r committing .
3
Commit Changes:
g i t commit =m ”<commit message >”: C r e a t e a s n a p s h o t o f t h e
s t a g e d c h a n g e s with a d e s c r i p t i v e message .
Pull Requests :
I f you a r e c o n t r i b u t i n g t o a p r o j e c t , you w i l l l i k e l y submit a
p u l l r e q u e s t t o p r o p o s e your c h a n g e s f o r r e v i e w and merging .
4. Merging Changes:
Merge Changes :
g i t merge <branch name >: I n t e g r a t e t h e c h a n g e s from a branch
i n t o t h e main branch ( e . g . , main o r d e v e l o p ) .
Resolving Co nfl ict s :
I f t h e r e a r e c o n f l i c t s , you w i l l need t o r e s o l v e them manually and then
commit t h e c h a n g e s .
g i t l o g : Shows t h e commit h i s t o r y o f t h e r e p o s i t o r y .
g i t branch : L i s t s a l l t h e b r a n c h e s i n t h e r e p o s i t o r y .
g i t f e t c h : Downloads t h e l a t e s t c h a n g e s from t h e remote r e p o s i t o r y w i t h o u t
merging them .
g i t p u l l : F e t c h e s c h a n g e s from t h e remote r e p o s i t o r y and merges them
i n t o your c u r r e n t branch .