Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

repodemo

This is a repo created for the crash-course on basic Git and Github.

What is a README?

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.

Why are READMEs Important?

  • 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

Common Sections in a README

  1. Project Title - Name of your project
  2. Description - What the project does
  3. Installation - How to install/setup
  4. Usage - How to use the project
  5. Examples - Code examples or screenshots
  6. Contributing - How others can contribute
  7. License - Project license information
  8. Contact - How to reach the maintainers

Markdown Basics for README

# 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 Workflow for Beginners

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:

1. Forking a Repository

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.

2. Cloning a Repository

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-name

What happens? Git downloads all files and the entire history of the project to your computer.

3. Making Changes

After cloning, you can create or modify files:

# Check current status
git status

# See what branch you're on
git branch

4. Staging Changes

Staging 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 status

Why Stage? You might have changed multiple files but only want to commit some of them. Staging gives you control.

5. Committing Changes

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

6. Pushing Changes

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-name

What happens? Your local commits are uploaded to GitHub, making them visible to others.

7. Pulling Changes

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-name

Why Pull? If others have made changes, you need to pull them to stay up-to-date.

Complete Workflow Example

# 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 main

Working with Branches

Branches 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-branch

Common Git Commands Quick Reference

git 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 file

Project Structure

This 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.

Getting Started

  1. Fork this repository (click "Fork" button at top-right)
  2. Clone your fork: git clone https://github.com/your-username/repodemo.git
  3. Explore the project folders
  4. Make changes or add your own examples
  5. Stage, commit, and push your changes
  6. Create a Pull Request to contribute back!

Contributing

Feel free to add more examples, improve documentation, or fix any issues you find. Follow the Git workflow described above to contribute!

License

See the LICENSE file for details.

About

This is a repo created for the crash-course on basic Git and Github.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages