GIT
GitHub Workflow
GitHub collaboration
GitHub Workflow
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.
Create a GitHub Repository
- Go to GitHub.com and sign in
- Click the "+" icon in the top right
- Select "New repository"
- Name your repository
- Choose public or private
- Click "Create repository"
Connect Local Repository to GitHub
After creating a repository on GitHub, connect your local repository:
# Add remote repository
git remote add origin https://github.com/username/repo-name.git
# Verify remote
git remote -v
Push to GitHub
Push your local commits to GitHub:
# Push to main branch
git push -u origin main
# For subsequent pushes
git push
Pull from GitHub
To get the latest changes from GitHub:
git pull origin main
Fork and Clone
To contribute to someone else's project:
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/your-username/repo.git - Make changes and commit
- Push to your fork
- Create a Pull Request
Pull Requests
Pull requests let you tell others about changes you've pushed to a branch in a repository. Once a pull request is opened, you can discuss and review the changes.
Tip: Always pull before you push to avoid conflicts. Use git pull to get the latest changes first.