Git & GitHub: A Quick Cheat Sheet
Basic Git Commands
git init
: Initialize a new Git repository in your project folder.git add .
: Stage all changes for a commit.git commit -m "Your commit message"
: Commit your changes with a descriptive message.git push origin main
: Push changes to your remote GitHub repository ('main' branch).git clone https://github.com/username/repo.git
: Clone an existing repository.
GitHub Workflow
- Create a Repository: On GitHub, start a new repository for your project.
- Connect Locally: Link your local project to the GitHub repository using
git remote add
. - Commit and Push: Work on your project, commit changes frequently, and push them to GitHub.
- Collaborate (Optional): If collaborating, use branches, pull requests, and issues for streamlined teamwork.
Remember: This is just the beginning! Git and GitHub offer much more. Explore online resources for deeper learning.