KEMBAR78
Git Hub | PDF | Version Control | Computer Programming
0% found this document useful (0 votes)
5 views9 pages

Git Hub

Uploaded by

safelysign954
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

Git Hub

Uploaded by

safelysign954
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Git & GitHub

Team Collaboration Guide


From Zero to Productive in Minutes

Your friendly development team guide

Welcome to Team Git!


This guide will get you from Git-zero to Git-hero in under 30 minutes.
Perfect for beginners, with all the essentials covered.
Git & GitHub Team Guide 2

1 One-Time Setup (Do This First!)

Prerequisites Check
Before diving in, make sure you have these essentials ready. Don’t worry—it’s easier than it looks!

1.1 Step 1: Install Your Tools


1. Install Git
• Windows: Download from git-scm.com
• Mac: Use Homebrew: brew install git or download from git-scm.com
• Linux: sudo apt install git (Ubuntu/Debian)

2. Install Visual Studio Code


• Download from code.visualstudio.com
• Lightweight, perfect for Git integration
• Alternative: Visual Studio Community (if you prefer full IDE)

3. Create GitHub Account


• Visit github.com
• Choose a professional username (you’ll use this with the team!)
• Essential for pushing code and collaborating

1.2 Step 2: Configure Git (One Command, Done Forever)


Open your terminal (or VS Code terminal) and run these commands:

Terminal Commands

git config -- global user . name " Your Full Name "
git config -- global user . email " your . email@company . com "

# Verify it worked :
git config -- list -- global

¥ Pro Tip
Use your real name and work email. This appears in commit history and helps teammates
identify your contributions!

1.3 Step 3: Connect VS Code to GitHub


1. Open VS Code
2. Click the Accounts icon (bottom-left) or press Ctrl+Shift+P
3. Search for "GitHub: Sign In"
4. Follow the browser authentication flow

Created for efficient team collaboration


Git & GitHub Team Guide 3

. Authentication Note
GitHub no longer accepts passwords! VS Code authentication is the easiest method. If you prefer
command-line, you’ll need a Personal Access Token.

2 For the Team Lead: Repository Setup

Team Lead Tasks


If you’re setting up the repository, follow these steps once. Team members can skip to the next
section.

2.1 Create the Team Repository


1. Go to GitHub and click "New Repository"

2. Choose a clear name: project-awesome or team-webapp

3. Add a description that explains the project

4. Initialize with:

• README.md (always helpful!)


• .gitignore template (choose your language/framework)
• License (if applicable)

5. Click "Create Repository"

2.2 Add Team Members


1. In your repository, go to Settings → Manage access

2. Click "Invite a collaborator"

3. Enter each team member’s GitHub username or email

4. Set permissions to "Write" (they can push code)

2.3 Share Repository Details


Send your team:

• Repository URL: https://github.com/username/repo-name

• Clone URL: https://github.com/username/repo-name.git

• Any project-specific setup instructions

Created for efficient team collaboration


Git & GitHub Team Guide 4

3 Daily Workflow: Your New Routine

¥ The Golden Rule


Always work on branches, never directly on main! This prevents conflicts and keeps the
main branch stable.

3.1 Clone the Repository (First Time Only)


Method 1: Using VS Code (Recommended)

1. Open VS Code

2. Press Ctrl+Shift+P (Command Palette)

3. Type "Git: Clone"

4. Paste the repository URL

5. Choose a folder on your computer

6. Click "Open" when it finishes

Method 2: Using Terminal

Clone Commands

cd / path / to / your / projects


git clone https :// github . com / username / repo - name . git
cd repo - name
code . # Opens in VS Code

3.2 Create Your Feature Branch


Before starting any work, create a new branch:

Branch Creation

# Create and switch to new branch


git checkout -b yourname / feature - description

# Examples :
git checkout -b john / user - login
git checkout -b sarah / fix - navigation - bug
git checkout -b mike / add - dark - theme

VS Code Method:

• Click the branch name in the status bar (bottom-left)

• Select "Create new branch"

• Enter your branch name

Created for efficient team collaboration


Git & GitHub Team Guide 5

Branch Naming Convention


Use the format: yourname/short-description

• Clear and descriptive

• Easy to identify who’s working on what

• Use hyphens, not spaces or underscores

3.3 Code, Save, Commit


The Development Cycle:

1. Make your changes (code, add files, edit documentation)

2. Save your files (Ctrl+S)

3. Stage your changes

4. Commit with a clear message

Commit Commands

# Stage all changes


git add .

# Or stage specific files


git add src / login . js README . md

# Commit with message


git commit -m " Add user login functionality

- Create login form component


- Add authentication API calls
- Update navigation to show user menu "

VS Code Method:

1. Open Source Control panel (Ctrl+Shift+G)

2. Review your changes

3. Click + next to files to stage them

4. Write a clear commit message

5. Click the checkmark to commit

¥ Great Commit Messages


Follow this pattern:

• First line: Short summary (50 chars max)

• Blank line

Created for efficient team collaboration


Git & GitHub Team Guide 6

• Details: What and why (if needed)

Examples:

• "Fix navigation menu on mobile devices"

• "Add user authentication with JWT tokens"

• "Update README with installation instructions"

3.4 Push to GitHub


Send your branch to GitHub so others can see it:

Push Commands

# First time pushing this branch


git push -u origin yourname / feature - description

# After that , just :


git push

VS Code Method:

• Click "Publish Branch" (first time)

• Or click "Push" (subsequent times)

• Or use the sync button

3.5 Create a Pull Request


1. Go to your repository on GitHub

2. You’ll see a green "Compare & pull request" button

3. Click it and fill out:

• Title: Clear description of what you built


• Description: What changed and why
• Any special testing instructions

4. Click "Create pull request"

Pull Request Best Practices


• Small PRs are easier to review

• Test your code before creating the PR

• Tag teammates if you need specific reviewers

• Link to issues if applicable (#123)

Created for efficient team collaboration


Git & GitHub Team Guide 7

3.6 Stay Updated


Before starting new work each day:

Sync Commands

# Switch to main branch


git checkout main

# Get latest changes


git pull origin main

# Switch back to your branch ( if continuing work )


git checkout yourname / feature - name

# Update your branch with latest main


git merge main
# OR ( advanced ) : git rebase main

VS Code Method:

• Use the Pull/Sync buttons in Source Control

• Switch branches using the branch selector

4 Visual Workflow
GitHub
Repository
4. Pull updates
1. Clone
3. Push & PR

Your Local Feature


Computer 2. Create Branch Branch

Daily work

Code, Commit,
Test

5 Essential Commands Cheat Sheet

Basic Git Commands


git add .
git commit -m " message "
# First time setup
git push -u origin my / feature
git clone < repo - url >
cd < repo - name >
# Stay updated
git checkout main
# Daily workflow
git pull origin main
git checkout -b my / feature

Created for efficient team collaboration


Git & GitHub Team Guide 8

Status & Info Commands


git checkout my / feature
git merge main
# See what ’ s changed
git status
git log -- oneline

# See differences
git diff
git diff -- staged

# Branch management
git branch -a
git checkout main
git branch -d old / branch

6 Essential .gitignore
Create a .gitignore file in your project root:

.gitignore Template

# OS generated files
. DS_Store
Thumbs . db

# IDEs and editors


. vscode /
. idea /
*. swp
*. swo

# Language specific
node_modules / # Node . js
bin / # . NET
obj / # . NET
__pycache__ / # Python
*. pyc # Python
target / # Java / Rust

# Environment files
. env
. env . local
. env . production

# Logs
*. log
logs /

# Build outputs
dist /
build /
out /

Created for efficient team collaboration


Git & GitHub Team Guide 9

7 Troubleshooting

. Common Issues & Quick Fixes


Issue: "Authentication failed" or "Password rejected"
Solution: Use VS Code’s GitHub sign-in or create a Personal Access Token
Issue: "Your branch is behind origin/main"
Solution: Run git pull origin main then git push
Issue: Merge conflicts appear
Solution: VS Code highlights conflicts. Edit files, keep correct lines, save, then git add and git
commit
Issue: Committed to main by mistake
Solution: Create a branch: git checkout -b my/fix then push the branch
Issue: Forgot to add a file to commit
Solution: git add missing-file.js then git commit –amend

8 Pro Tips for Team Success

¥ Level Up Your Git Game


• Commit early, commit often: Small commits are easier to review and debug

• Pull before you push: Always get latest changes before sharing yours

• Write descriptive branch names: sarah/fix-login-bug not sarah/stuff

• Test before PR: Make sure your code works before asking for review

• Review others’ code: You’ll learn new techniques and catch bugs

• Ask for help early: It’s faster than spending hours on Git problems

9 You’re Ready to Go!

Congratulations! You’re now a Git team player!


Remember: everyone was a beginner once. The team lead is here to help with any Git
questions.
Next steps:
• Clone the team repository

• Create your first feature branch

• Make a small change and create your first PR

• Celebrate your first merge!

Questions? Don’t hesitate to ask your team lead or check the


GitHub Documentation for more advanced features.

Created for efficient team collaboration

You might also like