Git and GitHub may seem a bit intimidating at first, but there’s no need to worry! Here’s a handy list of essential commands to help you smoothly get started. 💻✨
1. Setup Your Identity
Before doing anything, let Git know who you are:
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
2. Initialize a Repository
Start tracking your project:
git init
3. Check the Status
Know what’s happening in your repository:
git status
4. Add Files to Staging Area
Prepare your changes for a commit:
git add .
5. Commit Your Changes
Save your progress with a message:
git commit -m "Initial commit"
6. Connect to a Remote Repository
Link your local repository to GitHub:
git remote add origin https://github.com/yourusername/your-repo.git
7. Push Your Code to GitHub
Upload your changes:
git push -u origin main
8. Clone a Repository
Copy an existing repository to your local machine:
git clone https://github.com/username/repository.git
9. Pull Latest Changes
Stay updated with the remote repository:
git pull origin main
10. View Commit History
Check what’s been done:
git log
Pro Tip 💡
If you're unsure, git status
is your best friend!
With these commands, you’re ready to start your Git and GitHub journey. Happy coding! 🚀
Follow for more!
Top comments (0)