This is a repo created for the crash-course on basic Git and Github.
A README file is the first file that people see when they visit your repository. It's like a welcome page or an instruction manual for your project. README files are written in Markdown format (.md extension), which is a simple way to format text with headers, lists, links, code blocks, and more.
- First Impression: It's the first thing visitors see - make it count!
- Documentation: Explains what your project does and how to use it
- Instructions: Guides users on installation, setup, and usage
- Contribution Guidelines: Helps others contribute to your project
- Project Overview: Describes the purpose, features, and goals
- Project Title - Name of your project
- Description - What the project does
- Installation - How to install/setup
- Usage - How to use the project
- Examples - Code examples or screenshots
- Contributing - How others can contribute
- License - Project license information
- Contact - How to reach the maintainers
# Heading 1
## Heading 2
### Heading 3
**Bold Text**
*Italic Text*
- Bullet point 1
- Bullet point 2
1. Numbered item 1
2. Numbered item 2
[Link Text](https://example.com)
`inline code`
```code block```Git is a version control system that helps you track changes in your code. GitHub is a platform that hosts Git repositories online. Here's a complete workflow:
Forking creates your own copy of someone else's repository on your GitHub account.
- Go to the repository you want to fork on GitHub
- Click the "Fork" button in the top-right corner
- GitHub creates a copy of the repository under your account
Why Fork? You can make changes without affecting the original project. Later, you can submit your changes back via Pull Requests.
Cloning downloads a repository from GitHub to your local computer.
# Clone a repository
git clone https://github.com/username/repository-name.git
# Navigate into the cloned directory
cd repository-nameWhat happens? Git downloads all files and the entire history of the project to your computer.
After cloning, you can create or modify files:
# Check current status
git status
# See what branch you're on
git branchStaging prepares your changes to be committed. Think of it as selecting which changes you want to save.
# Stage a specific file
git add filename.txt
# Stage all changed files
git add .
# Stage multiple specific files
git add file1.txt file2.txt
# Check what's staged
git statusWhy Stage? You might have changed multiple files but only want to commit some of them. Staging gives you control.
Committing saves your staged changes with a descriptive message.
# Commit with a message
git commit -m "Add new feature or fix bug"
# Commit with a detailed message
git commit -m "Short description" -m "Longer detailed explanation"Best Practices for Commit Messages:
- Use present tense: "Add feature" not "Added feature"
- Be descriptive but concise
- Explain what and why, not how
Pushing uploads your local commits to GitHub (remote repository).
# Push to the main/master branch
git push origin main
# Push to a different branch
git push origin branch-name
# First time push of a new branch
git push -u origin new-branch-nameWhat happens? Your local commits are uploaded to GitHub, making them visible to others.
Pulling downloads changes from GitHub to your local repository.
# Pull latest changes from the current branch
git pull
# Pull from a specific branch
git pull origin branch-nameWhy Pull? If others have made changes, you need to pull them to stay up-to-date.
# 1. Fork the repository on GitHub (via web interface)
# 2. Clone your forked repository
git clone https://github.com/your-username/repodemo.git
cd repodemo
# 3. Make changes to files
echo "New content" >> file.txt
# 4. Check status
git status
# 5. Stage your changes
git add file.txt
# 6. Commit your changes
git commit -m "Update file.txt with new content"
# 7. Push to GitHub
git push origin main
# 8. Pull latest changes (if working with others)
git pull origin mainBranches let you work on features without affecting the main code.
# Create a new branch
git branch feature-branch
# Switch to the branch
git checkout feature-branch
# Create and switch in one command
git checkout -b feature-branch
# List all branches
git branch
# Push new branch to GitHub
git push -u origin feature-branch
# Merge branch into main
git checkout main
git merge feature-branchgit status # Check status of your repository
git log # View commit history
git diff # See changes not yet staged
git diff --staged # See changes that are staged
git branch # List branches
git branch -d branch # Delete a branch
git remote -v # View remote repositories
git fetch # Download changes without merging
git reset HEAD file # Unstage a file
git checkout -- file # Discard changes to a fileThis repository contains three example projects for learning different programming languages:
- Project1/ - Python basics and examples
- Project2/ - C basics and examples
- Project3/ - C++ basics and examples
Each project folder contains its own README with language-specific information and code examples.
- Fork this repository (click "Fork" button at top-right)
- Clone your fork:
git clone https://github.com/your-username/repodemo.git - Explore the project folders
- Make changes or add your own examples
- Stage, commit, and push your changes
- Create a Pull Request to contribute back!
Feel free to add more examples, improve documentation, or fix any issues you find. Follow the Git workflow described above to contribute!
See the LICENSE file for details.