0% found this document useful (0 votes)
48 views8 pages

GitHub Fundamentals

GitHub is a web-based platform for version control and collaboration, allowing developers to store and manage code changes. Key concepts include repositories, version control, and commits, with a focus on setting up accounts, creating repositories, and managing files. The document also covers collaboration features, best practices, and security measures to ensure effective use of GitHub.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views8 pages

GitHub Fundamentals

GitHub is a web-based platform for version control and collaboration, allowing developers to store and manage code changes. Key concepts include repositories, version control, and commits, with a focus on setting up accounts, creating repositories, and managing files. The document also covers collaboration features, best practices, and security measures to ensure effective use of GitHub.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

GitHub Fundamentals

What is GitHub?
GitHub is a web-based platform for version control and collaboration. It allows you to store,
track, and manage changes to your code and files. Think of it as Google Drive for developers,
but with powerful features to track every change you make.

Key concepts:

 Repository (repo): A folder containing your project files and their history
 Version control: System that tracks changes to files over time
 Git: The underlying technology that powers GitHub
 Commit: A saved snapshot of your project at a specific point in time

Setting Up Your GitHub Account


1. Go to github.com
2. Click "Sign up"
3. Choose a username (this will be part of your GitHub URL)
4. Enter email and create a password
5. Verify your account through email

Profile setup:

 Add a profile picture


 Write a brief bio
 Add your location and website if desired

Understanding the GitHub Interface


Repository page elements:

 Code tab: Shows your files and folders


 Issues tab: Track bugs and feature requests
 Pull requests tab: Manage code contributions
 Actions tab: Automated workflows
 Projects tab: Project management tools
 Wiki tab: Documentation
 Settings tab: Repository configuration

File view:

 File tree on the left


 File content in the main area
 Commit history and branch information at the top
 README.md displays automatically below files
Creating Your First Repository
Method 1: From GitHub website

1. Click the "+" icon in top right


2. Select "New repository"
3. Choose a repository name
4. Add a description (optional but recommended)
5. Choose public or private
6. Initialize with README (recommended for beginners)
7. Click "Create repository"

Method 2: Import existing project

1. Click "Import repository"


2. Enter the URL of existing repository
3. Choose new repository name
4. Set visibility and create

Basic File Operations


Creating files:

1. Navigate to your repository


2. Click "Add file" → "Create new file"
3. Type filename in the name field
4. Add content in the editor
5. Scroll to bottom for commit message
6. Write descriptive commit message
7. Click "Commit new file"

Editing files:

1. Navigate to the file


2. Click the pencil icon (Edit this file)
3. Make your changes
4. Add commit message describing changes
5. Click "Commit changes"

Uploading files:

1. Click "Add file" → "Upload files"


2. Drag and drop or click to select files
3. Add commit message
4. Click "Commit changes"

Deleting files:

1. Navigate to the file


2. Click trash icon (Delete this file)
3. Add commit message
4. Click "Commit changes"

Understanding Commits
Every change in GitHub is saved as a commit. Each commit includes:

 Commit message: Brief description of what changed


 Timestamp: When the change was made
 Author: Who made the change
 Unique ID: Hash that identifies this specific change

Writing good commit messages:

 Use present tense ("Add feature" not "Added feature")


 Be specific and concise
 Explain what and why, not how
 Examples:
o "Fix login button alignment"
o "Add user authentication system"
o "Update README with installation instructions"

Viewing History and Changes


Commit history:

1. Click on "commits" link (shows number like "23 commits")


2. Browse through all changes made to the repository
3. Click any commit to see exactly what changed

Comparing changes:

 Green lines (with +): Added content


 Red lines (with -): Removed content
 Modified lines show both removal and addition

File history:

1. Navigate to any file


2. Click "History" button
3. See all commits that modified this specific file

Branching Basics
Branches allow you to work on different versions of your project simultaneously.

Default branch:
 Usually called "main" or "master"
 Contains the official version of your project

Creating a branch:

1. Click the branch dropdown (shows current branch name)


2. Type new branch name
3. Click "Create branch"

Switching branches:

1. Click branch dropdown


2. Select different branch
3. Repository view updates to show that branch's content

When to use branches:

 Testing new features


 Fixing bugs
 Experimenting with changes
 Collaborating without affecting main code

README Files
README.md is the first thing people see when visiting your repository.

What to include:

 Project title and description


 How to install/use the project
 Examples or screenshots
 Contributing guidelines
 License information
 Contact information

Markdown basics for README:

# Large Heading
## Medium Heading
### Small Heading

**Bold text**
*Italic text*

- Bullet point
- Another bullet point

1. Numbered list
2. Second item

[Link text](URL)
![Alt text](image-URL)

`Code snippet`

Code block

Issues and Project Management


Creating issues:

1. Go to Issues tab
2. Click "New issue"
3. Add descriptive title
4. Explain the problem or feature request
5. Add labels if available
6. Assign to team members if applicable
7. Click "Submit new issue"

Issue labels:

 bug: Something isn't working


 enhancement: New feature request
 documentation: Improvements to docs
 help wanted: Extra attention needed
 good first issue: Good for newcomers

Managing issues:

 Comment to provide updates


 Close when resolved
 Reference issues in commits using #issue-number

Collaboration Features
Watching repositories:

 Click "Watch" to get notifications about activity


 Choose notification level (all activity, releases only, etc.)

Starring repositories:

 Click "Star" to bookmark interesting projects


 Stars also show appreciation to project owners

Following users:

 Visit user profiles and click "Follow"


 See their activity in your dashboard
Basic Collaboration Workflow
Contributing to someone else's project:

1. Fork the repository (creates your own copy)


2. Make changes in your fork
3. Create a Pull Request to propose your changes
4. Original owner reviews and merges if approved

Inviting collaborators to your project:

1. Go to repository Settings
2. Click "Manage access"
3. Click "Invite a collaborator"
4. Enter their GitHub username
5. They can now directly edit your repository

GitHub Desktop vs Web Interface


Web interface advantages:

 No installation required
 Great for simple edits
 Easy file browsing
 Good for beginners

When you might want GitHub Desktop:

 Working with large projects


 Making many files changes
 Better for complex workflows
 Offline work capability

Best Practices
Repository organization:

 Use clear, descriptive names


 Organize files in logical folders
 Keep repositories focused on single projects
 Include LICENSE and README files

Commit practices:

 Commit frequently with small changes


 Write clear commit messages
 Test before committing
 Don't commit sensitive information (passwords, API keys)
Collaboration:

 Be respectful in issues and comments


 Provide clear descriptions of problems
 Test others' suggestions before commenting
 Thank contributors

Common Mistakes to Avoid


 Committing large binary files (images, videos) frequently
 Using unclear commit messages like "fixes" or "updates"
 Not adding README files
 Ignoring security warnings
 Committing sensitive data like passwords
 Making too many changes in a single commit

Security and Privacy


Public vs Private repositories:

 Public: Anyone can see and fork


 Private: Only you and invited collaborators can access

What not to commit:

 Passwords or API keys


 Personal information
 Large media files
 Temporary files

Security features:

 Two-factor authentication (enable in settings)


 Security alerts for vulnerable dependencies
 Dependabot for automatic security updates

Next Steps
After mastering these basics, explore:

 GitHub Pages (free website hosting)


 GitHub Actions (automated workflows)
 Advanced Git commands through command line
 Open source contribution
 Project management with GitHub Projects
 GitHub Codespaces (cloud development environment)

Practice Exercise
Create a personal portfolio repository:

1. Create new repository named "portfolio"


2. Add README.md with your bio and skills
3. Create folders: projects, images, docs
4. Add sample project file in projects folder
5. Create an issue for "Add contact information"
6. Make several commits with different changes
7. Practice viewing history and comparing changes

This hands-on practice will reinforce all the concepts covered and give you a real repository
to build upon.

You might also like