Introduction
Hello,I'm currently a data science student and this is my understanding of git workflow, from creating folders on my local computer to adding files, pushing and having them on my github repository.
Working directory
This is the active folder created in the local machine which will have all the files related to the project.
We can create a folder on terminal by following the steps,
-Launch your terminal
-cd desktop :this is to ensure that we are in the desktop folder
-mkdir data :this is to create a new folder on desktop
-touch school.py :this is to create a python file inside the data folder
-git status :this tells us the repository we are working in
Staging
This allows us to prepare to save the files that we have created. We can save a specific file or all files at once. For example;assuming we have three different files eg.schools.py ,books.py ,teachers.py
-git add . :this saves all the files in the folder
-git add schools.py :this saves only the schools files
Commit
This allows us to save the files from the staging step.
.git commit -m "creating schools files"
.git commit :saves the files to git hub
.-m :this is a message that explains the change that happens in the folder
." " :this briefly explains the change that happened
Push
This allows us to move our work from our local computer to git hub.
git push origin main ;origin points us to our online git hub while main is the name of the branch where we are making the changes
Top comments (0)