GitHub Series #5 : Understanding Clone, Commit, Push, Publish, and Pull
When using Git, you'll frequently come across several key terms. Becoming familiar with these will help you better understand how Git works. Below is a summary of the most commonly used commands and when to use them.
Clone
What it means : Copy a GitHub repository to your local computer.
When to use : When you’ve created a repository on GitHub and want to start working on it locally.
Example : Studying or modifying an open-source project made by someone else.
Commit
What it means : Save changes to your local repository (record a version).
When to use : After editing or creating files and you want to record those changes.
Note : A commit only saves changes to your local Git repository — not to GitHub.
Push
What it means : Upload your committed changes to GitHub.
When to use : When you're ready to back up your work or share it with others via GitHub.
Flow : You must commit first, then push to apply changes on GitHub.
Publish
What it means : Upload a local Git repository to GitHub for the first time.
When to use : If you started a project on your computer and now want to sync it with GitHub.
Example : You’ve created a new folder and initialized Git locally, and now want to push it online.
Pull
What it means : Fetch changes from GitHub and apply them to your local repository.
When to use : In collaboration settings, to update your local copy with changes made by others.
Summary
If you clearly understand just these five terms, you’ll be well on your way to mastering the Git workflow.
Most important distinction: Commit saves changes locally, while Push uploads them to GitHub. (This can be confusing if you're used to SVN, where commit uploads to the server immediately.)