Version Control
Version control is a system that tracks changes in documents, enabling easy recovery of older versions and collaboration among users.
Git
- License: GNU General Public License
- Type: Distributed Version Control System (VCS)
- Usage: Tracks changes not only in code but also in documents and images.
Advantages of Git
- Enables multiple users to have a copy of the code and synchronize changes.
- It's one of the most commonly used version control systems.
GitHub and Alternatives
- GitHub: A widely-used service for hosting Git repositories.
- Alternatives: GitLab, BitBucket, Beanstalk offer similar functionalities.
Basic Git Concepts
- SSH Protocol: A secure method for remote login.
- Repository: A project folder under version control.
- Fork: A copy of a repository.
- Pull Request: A method for submitting changes for review.
- Working Directory: Local files associated with a Git repository.
Essential Git Commands
git init
: Initialize a new Git repository.git add
: Stage changes for commit.git status
: Display the status of changes.git commit
: Commit changes to the repository.git reset
: Revert changes in the staging area or working directory.git log
: View a log of previous changes.git branch
: Create or manage branches.git checkout
: Switch between branches.git merge
: Combine changes from different branches.
Learning Resources
- GitHub Learning: Accessible at try.github.io, provides cheat sheets and tutorials for Git.
Creating a Repository
Components
- Repository: A data structure to store documents with version-control capabilities.
- Organization: A group of user accounts owning repositories, with administrative owners.
Steps to Create a Repository
- Choose to create a new repository or take the
Introduction to GitHub
course after signing up. - A repository typically includes:
README
file: Describes the project's purpose.License
: Specifies how the code can be used.
- Repositories can be
private
orpublic
.
Repository Tabs
- Code: Contains all the source files.
- Issues: Manages tasks and bugs.
- Pull Requests: Reviews and discusses changes.
- Projects: Organizes project work.
- Wiki, Security, Insights: Provides additional tools for advanced users.
- Settings: Customizes repository settings.
Creating a GitHub Account
Before utilizing these instructions, register and log in to your GitHub account.
Creating a New Repository
- Navigate and select
New Repository
from the+
menu. - Fill in details like the repository name and description.
- Choose the repository's visibility.
- Opt to initialize the repository with a README file.
- Create the repository.
Managing Repository Content
- Editing
ReadMe.md
:- Use the online editor.
- Commit changes after editing.
- Creating a New File:
- Name and provide details for the file.
- Enter the code and commit changes.
- Editing an Existing File:
- Make changes and commit.
- Uploading Files:
- Upload files from your local system and commit changes.