-
Notifications
You must be signed in to change notification settings - Fork 0
Session 2 Git and GitHub
In this session, we'll learn about version control systems, specifically Git, and how to use GitHub for collaborative software development. These tools are essential for modern software development and are used by nearly every professional developer.
- Understand what version control is and why it's important
- Learn basic Git commands and workflow
- Create a GitHub account and repository
- Understand branching, merging, and pull requests
- Learn how to collaborate with others using Git and GitHub
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. It allows multiple people to work on a project simultaneously without overwriting each other's changes.
Git is a distributed version control system that tracks changes in any set of computer files. It was created by Linus Torvalds in 2005 for the development of the Linux kernel.
- Repository (repo): A storage location where your project files and their revision history are kept
- Commit: A snapshot of your repository at a specific point in time
- Branch: A parallel version of the repository that doesn't affect the main branch
- Merge: The act of integrating changes from one branch into another
# Initialize a new Git repository
git init
# Check the status of your repository
git status
# Add files to the staging area
git add filename
git add . # Add all files
# Commit changes with a message
git commit -m "Your message here"
# View commit history
git logGitHub is a web-based platform that uses Git for version control. It provides additional features like:
- Hosting repositories online
- Issue tracking
- Pull requests
- Project management
- Code reviews
- Creating an account
- Creating a new repository
- Connecting your local repository to GitHub
- Pushing your code to GitHub
# Connect local repository to GitHub
git remote add origin https://github.com/yourusername/your-repo-name.git
# Push your code to GitHub
git push -u origin main- Forking a repository
- Cloning a repository
- Creating branches
- Making pull requests
- Reviewing and merging code
# Clone a repository
git clone https://github.com/username/repository.git
# Create and switch to a new branch
git checkout -b feature-branch
# Push branch to GitHub
git push origin feature-branch- Create a GitHub account and set up your profile
- Create a new repository and add a README.md file
- Make changes locally and push them to GitHub
- Create a branch, make changes, and create a pull request
- Collaborate with a classmate on a simple project
- Git Official Documentation
- GitHub Guides
- Learn Git Branching
- Oh Shit, Git!?! (For when things go wrong)
Now that you understand Git and GitHub, you're ready to move on to Session 3: HTML and CSS where you'll learn how to create and style web pages.