0% found this document useful (0 votes)
2 views17 pages

Git Tutorial Assignment

The document provides an overview of Git, a Source Control Management tool, detailing its installation, initial setup, and repository creation. It covers essential configurations, file management, and GitHub integration, along with collaboration features and advanced commands. The conclusion summarizes the core functionalities of Git and GitHub for effective project management and collaboration.

Uploaded by

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

Git Tutorial Assignment

The document provides an overview of Git, a Source Control Management tool, detailing its installation, initial setup, and repository creation. It covers essential configurations, file management, and GitHub integration, along with collaboration features and advanced commands. The conclusion summarizes the core functionalities of Git and GitHub for effective project management and collaboration.

Uploaded by

silky2556
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION (CIVE)

COURSE NAME: OPEN SOURCE TECHNOLOGIES

COURSE CODE: CP 222

COURSE: CSDFE2

TUTORIAL

REGISTRATION NUMBER: T23-03-10342


1. Introduction
Git is a Source Control Management (SCM) tool that allows tracking and managing changes to
files over time. It enables users to revert to previous versions of files, collaborate with others,
and maintain a consistent history of development.

2. Installation
Download and Install Git
Operating in a Linux operating system, Git is thus pre-installed with it.

Verifying Installation

Run the command git --version to verify installation:


3. Initial Setup
Making and Navigating to a Directory

4. Creating Your First Repository


Method 1: Initialize Current Directory
git init
Method 2: Create New Directory and Initialize
git init sub-repos

Essential Configuration
a) git config --global init.defaultBranch main

b) git branch -m main

c) git config --global user.name "username"


d) config --global user.email "[email protected]"

Verify Configuration
i) git config --global user.name

ii) git config --global user.email

Check Repository Creation


ls -a

Showing git status


Activity 1: Create Your First Git Repository
In continuation with the repository and configurations above.

5. Working with Files


Creating Files via Terminal
nano newfile.py

Nano Editor Commands

● Save: Ctrl + O

● Exit: Ctrl + X

Activity 1: Create and Run a Python Script


Following the file created above

1. Adding code in the python script


print("Hello World!")

2. Save & Exit:

● Ctrl + O, Enter

● Ctrl + X

4. Run the script.

python newfile.py
Activity 2: Complete Git Workflow
1. Check and add file.
git status

git add newfile.py

2. Commit:

git commit -m "saving original file"


git log

3. Modify the file and update:


nano myFirstFile.py

# Change: print("Hello World! and Stanford!")

python newfile.py
git diff

4. Stage and commit again.


git add newfile.py

git commit -m "added more to text"

git log
6. GitHub Integration
Create GitHub Account and Repository

● Create a new repository

Push Local Repo to GitHub


git remote add origin [repo-URL]
git branch -M main

git push -u origin main


7. Collaboration Features
Add Collaborators

● Go to repo → Settings → Collaborators


Clone a Repo
git clone url
8. Advanced Features
Other commands
1. git pull

2. git fetch and git merge

3. .gitignore File
a. git status
b. Create a .gitignore file

c. Add to the root

d. git status

e. Commit
9. Conclusion
This lab introduced the core functionality of Git and GitHub, including:

● Creating and configuring a repository

● Managing files with Git

● Tracking changes through commits and logs

● Using .gitignore for clean project management

● Integrating with GitHub for cloud collaboration

You might also like