Welcome! This document will guide you through basic Git and GitHub practice tasks.
You can complete them step by step to get familiar with version control workflows.
-
Install Git
- Download Git
- Configure your user info:
git config --global user.name "Your Name" git config --global user.email "your_email@example.com"
-
Clone the repository
git clone https://github.com/<your-username>/<repo-name>.git
cd <repo-name>Try these in order:
| Goal | Command Example |
|---|---|
| Check your branch | git branch |
| Create a new branch | git checkout -b feature/hello-git |
| Add a new file | echo "Hello Git!" > hello.txt |
| Stage changes | git add hello.txt |
| Commit changes | git commit -m "Add hello.txt" |
| Push to GitHub | git push origin feature/hello-git |
Then go to GitHub and create a Pull Request (PR) to merge your branch into main.
-
Create a new branch
- Name it
feature/<your-name>. - Add a file named
<your-name>.mdthat includes a short introduction about yourself.
- Name it
-
Modify an existing file
- Edit
practice.mdto add your name to the "Contributors" section.
- Edit
-
Fix a conflict
- Pair with a friend or classmate.
- Both of you edit the same line in the same file on separate branches.
- Try merging and resolve the merge conflict.
Add your name below once you’ve completed your practice:
- Your Name
- (Add more names here!)
-
Keep commit messages clear and meaningful. Example:
feat: add new greeting feature fix: correct typo in readme docs: update practice instructions -
Always pull the latest code before starting a new feature:
git pull origin main
Happy coding 🎉 If you get stuck, check the Git Handbook.