Overview
Git is a version control system that helps developers to track changes made to files as system or project is being developed.
GitHub is a website where all the projects build in folders and files are put for collaboration or tracking purposes.
This overview show the steps of pushing codes, files and folders to github repository step by step.
Working Directory
Working directory is the project folder with all the files you are working on.
File can be modified or deleted but not saved on Git, changes are saved until you commit.
Staging (git add)
git add Puts changes made in the staging area
git add . stage all changes new, modified, and deleted files
Commit (git commit)
Saves staged changes to the local repository
_git commit -a -m "Message" _ to stage and commit all modified and deleted files in one step.
Push(git push)
git push Sends the commits to the remote repository e.g github
Checking Status(git satus)
git status used to check which files are staged, not staged or untacked.
It helps to keep track of what is needed to add or commit.
git status
git add analysis.py
git status git commit -m "Add sales analysis"
git push
conclusion
The git workflow work as a sequence.
Working Directory is where changes are made.
Staging Area it help to select changes to be included.
Commit records the staged changes in the local git history .
Push sends the commits to the git hub
Example of the workflow
Working Directory
git add
Staging Area
git commit
Local Repository
git push
GitHub
Example
git init, initialize the git repository to manage the project
git status, show the current happening on the repository
git add .,stages project ready for commit
git commit -m "Done"
git log, view commit
git log --oneline, shows project history
git branch, confirms the branch
git branch -M main, change branch from master to main
git remote add origin "ssh GitHub link", connect local repository to the GitHub repository.
git remote -v, check, check the remote repository connected to local project
git push -u origin main, uploads locals commits to GitHub
Top comments (0)