I have a folder 'OOP-AFTI' which will contain my projects. For now it looks like (I will add new folders in the main folder for next projects):
-OOP-AFTI
--Stack
---main.c
---stack.c
---stack.h
So, how to use git correctly? And how to use github correctly
Assistant
Great! You have a main folder OOP-AFTI which contains project folders like Stack, and inside each project folder you have source files. Here's how to use Git correctly and GitHub effectively with this structure.
1. How to Use Git Correctly in Your Setup
Option A: One Git repository for the entire OOP-AFTI folder
You treat OOP-AFTI as one Git repo, i.e. all your projects (Stack, others) live inside that repo.
Good if projects are related or you want a single history for all projects.
Simpler to manage as one repo.
How to set this up:
Open terminal/command line.
Go to your main folder:
bash
cd path/to/OOP-AFTI
Initialize Git:
bash
git init
Add files:
bash
git add .
Commit:
bash
git commit -m "Initial commit with Stack project"
From now on:
Each time you add a new project folder inside OOP-AFTI, just git add the changes and commit.
Pros:
Single repo, simple.
Easy to share all projects at once.
Cons:
All projects share one commit history.
Large repo as more projects are added.
Option B: One Git repository per project folder (Stack, etc)
Each project is independent; you init git inside each project folder (Stack/, another /Project2, etc).
Recommended if projects are unrelated or you want separated histories and repos.