Git Sticky Notes - johnverz22/webdev1-lessons GitHub Wiki
-
Initialize Git Repository
git init
-
Link to Remote GitHub Repository
git remote add origin <repo-URL>
-
Set Up Local Configuration
(Run once per repo if global config is already set)git config user.name "Your Name" git config user.email "[email protected]"
-
(Optional) Logout of GitHub on shared computers
(If another account is currently logged in, run the following to logout)git credential-cache exit
-
Check Status
(See current changes)git status
-
Stage Changes
(Prepare to save all changes)git add .
-
Commit Changes
(Save prepared changes locally, providing a message or description)git commit -m "Your meaningful message"
-
Push to GitHub
(Send commits to remote repo to update it)git push origin <branch-name>
Default branch is usually
main
.
- Commit Often: Small commits make it easier to track changes.
- Meaningful Messages: Always describe what was changed or fixed.
-
Pull Before Push: Stay updated with remote changes.
git pull --rebase origin main
Keep this handy for smooth Git workflows! 🚀