https://github.com/umarilly/git-and-github-learning
A beginner-friendly Git-Learning repository designed to help you understand the basics of Git and GitHub. It covers essential commands, workflows, branching, merging, and collaboration tips. Perfect for students and developers looking to master version control through hands-on practice.
https://github.com/umarilly/git-and-github-learning
git github
Last synced: 8 months ago
JSON representation
A beginner-friendly Git-Learning repository designed to help you understand the basics of Git and GitHub. It covers essential commands, workflows, branching, merging, and collaboration tips. Perfect for students and developers looking to master version control through hands-on practice.
- Host: GitHub
- URL: https://github.com/umarilly/git-and-github-learning
- Owner: umarilly
- Created: 2024-10-16T19:34:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-07T22:46:17.000Z (10 months ago)
- Last Synced: 2025-04-12T09:14:47.288Z (10 months ago)
- Topics: git, github
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 Git and GitHub Learning
A comprehensive guide to mastering Git and GitHub
## 📋 Table of Contents
- [Introduction](#-introduction)
- [Prerequisites](#-prerequisites)
- [Beginner Topics](#-beginner-topics)
- [Intermediate Topics](#-intermediate-topics)
- [Advanced Topics](#-advanced-topics)
- [Best Practices](#-best-practices)
- [Resources](#-resources)
## 🌟 Introduction
This repository serves as a comprehensive guide for learning Git and GitHub, from basic concepts to advanced techniques. Whether you're a complete beginner or an experienced developer looking to enhance your version control skills, this resource will help you master Git and GitHub effectively.
### 🎯 What You'll Learn
- **Core Git Concepts**: Understand the fundamentals of version control
- **Command Mastery**: Learn essential Git commands and their applications
- **Collaboration**: Master GitHub workflows for team projects
- **Advanced Techniques**: Explore powerful Git features for complex scenarios
- **CI/CD Integration**: Learn to automate workflows with GitHub Actions
## 🔧 Prerequisites
Before diving into this repository, ensure you have:
- **Command Line Basics**: Familiarity with terminal/command prompt
- **Text Editor**: VS Code, Sublime Text, or any preferred editor
- **Git Installation**: [Download Git](https://git-scm.com/downloads)
- **GitHub Account**: [Sign up for GitHub](https://github.com/signup)
## 📚 Beginner Topics
### 1. Introduction to Git
- **What is Git?**: A distributed version control system that tracks changes in source code
- **Why Use Git?**: Enables collaboration, history tracking, and code management
- **Basic Concepts**: Repository, commit, branch, and working directory
### 2. Installing Git
- **Windows**: Download and run the installer from git-scm.com
- **macOS**: Use Homebrew: `brew install git`
- **Linux**: Use package manager: `sudo apt install git` (Ubuntu/Debian)
- **Verification**: Run `git --version` to confirm installation
### 3. Git Configuration
```bash
# Set your name
git config --global user.name "Your Name"
# Set your email
git config --global user.email "your.email@example.com"
# Set default editor
git config --global core.editor "code --wait"
```
### 4. Basic Commands
- **`git init`**: Initialize a new Git repository
```bash
git init
```
Creates a new `.git` directory in your project
- **`git add`**: Stage changes for commit
```bash
git add . # Stage all changes
git add filename.txt # Stage specific file
```
- **`git commit`**: Save staged changes
```bash
git commit -m "Your commit message"
```
Creates a new commit with your changes
- **`git status`**: Check repository status
```bash
git status
```
Shows modified files and staging status
- **`git log`**: View commit history
```bash
git log # Basic log
git log --oneline # Compact log
git log --graph # Visual branch history
```
### 5. Working with Repositories
- **Creating Repositories**:
```bash
# Local repository
git init
# GitHub repository
# Create on GitHub.com, then:
git remote add origin https://github.com/username/repo.git
```
- **Cloning Repositories**:
```bash
git clone https://github.com/username/repo.git
```
### 6. Undoing Changes
- **`git checkout`**: Discard changes
```bash
git checkout -- filename.txt
```
- **`git reset`**: Unstage changes
```bash
git reset HEAD filename.txt
```
- **`git commit --amend`**: Fix last commit
```bash
git commit --amend -m "New commit message"
```
- **`.gitignore`**: Exclude files
```bash
# Example .gitignore
node_modules/
.env
*.log
```
## 📖 Intermediate Topics
### 1. Branching and Merging
- **Creating Branches**:
```bash
git branch feature-branch # Create branch
git checkout feature-branch # Switch to branch
git checkout -b feature-branch # Create and switch
```
- **Merging**:
```bash
git checkout main
git merge feature-branch
```
- **Resolving Conflicts**:
1. Edit conflicted files
2. Stage resolved files
3. Complete merge with `git commit`
### 2. Remote Operations
- **`git push`**: Send changes to remote
```bash
git push origin main
```
- **`git pull`**: Fetch and merge
```bash
git pull origin main
```
- **`git fetch`**: Get remote changes
```bash
git fetch origin
```
### 3. Collaboration Features
- **Forking**: Create personal copy of repository
- **Pull Requests**: Propose changes to original repository
- **Code Review**: Review and discuss changes
### 4. Advanced Commands
- **`git stash`**: Save changes temporarily
```bash
git stash save "Work in progress"
git stash pop
```
- **`git tag`**: Mark important points
```bash
git tag v1.0.0
git push --tags
```
## 🚀 Advanced Topics
### 1. Git Workflows
- **Git Flow**: Feature branches, develop, release branches
- **GitHub Flow**: Simple branch-based workflow
- **Trunk-Based Development**: Short-lived feature branches
### 2. Advanced Techniques
- **`git rebase`**: Rewrite commit history
```bash
git rebase main
```
- **`git cherry-pick`**: Apply specific commits
```bash
git cherry-pick commit-hash
```
- **Git Hooks**: Automate tasks
```bash
# Example pre-commit hook
#!/bin/sh
npm test
```
### 3. Repository Management
- **Submodules**: Include other repositories
```bash
git submodule add https://github.com/user/repo.git
```
- **LFS**: Handle large files
```bash
git lfs track "*.psd"
```
## 💡 Best Practices
### 1. Commit Messages
- Use imperative mood: "Add feature" not "Added feature"
- Keep first line under 50 characters
- Include detailed description if needed
### 2. Branch Naming
- `feature/`: New features
- `bugfix/`: Bug fixes
- `hotfix/`: Urgent fixes
- `release/`: Release preparation
### 3. Collaboration
- Regular updates from main branch
- Clear pull request descriptions
- Code review guidelines
## 📚 Resources
### Documentation
- [Official Git Documentation](https://git-scm.com/doc)
- [GitHub Docs](https://docs.github.com)
- [GitHub Flow Guide](https://guides.github.com/introduction/flow/)
### Learning Materials
- [GitHub Learning Lab](https://lab.github.com)
- [GitHub Skills](https://skills.github.com)
- [Atlassian Git Tutorial](https://www.atlassian.com/git/tutorials)
### Cheat Sheets
- [Git Cheat Sheet](https://education.github.com/git-cheat-sheet-education.pdf)
- [GitHub Flow Cheat Sheet](https://guides.github.com/introduction/flow/)
---