Version control systems are used in managing revision control of project artifacts, and maintaining a history of changes to each artifact. Artifacts can include documents, source code, and much more.
Motivations for Source Version Control
- Keeping track of code
- Storing versions of code changes
- Restoring previous versions
- Reviewing work history
- Collaborating in a group
- There are two main approaches to version control management systems. That is, they can either be centralized, or decentralized repositories. This page covers Git is a decentralized system.
Git vs GitHub #
Git — The version control tool that GitHub is built on top of. You do not need GitHub to use Git. You can install git to your machine to use locally.
GitHub is a hosting service using git the open source revision control system. Github’s service allows you to share your code with the world, and also has several other collaboration features.
Common Git Commands #
Some common workflow steps
||puts changes to the stage|
||logs the staged|
||uploads the local master branch to server|
Other common commands
||downloads latest version from server|
||checks for changes but doesn’t download it|
||copies a server verion to local machine|
||shows the server address|
Workspace and Commits #
- Workspace - this is where you have files you’re editing in a folder
- Stage - this is where you put files or selected lines into an area to be given a commit message
- Commit Log - a history of committed changes.
Workflow for “syncing” your local and remote repos #
The first time you copy from the server, you are cloning the repository. Once you have a local copy, getting more updates is considered a pull.
When you make edits on your local machine, you save snapshots or revisions to your commit log. When you’re done for the day, you can push or upload changes back to ther remote.
Suggested reading #
Read Chapters 1-2 of the git book: https://git-scm.com/book/en/v2
Creating a new repository on GitHub https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-new-repository