I did research and learnt about forking, collaboration, pull requests, merge conflicts, code review, GitHub issues, git commands and pushing changes to GitHub.
To make my learning of Django easier.
1. Forking.
Forking is creating your own copy of someone else’s repository on GitHub.
When to use forking:
- When you want to contribute to an open-source project.
- When you want to freely experiment with changes without affecting the original. Example: Click the "Fork" button on a repo page → GitHub copies the repo to your account.
2. Collaboration.
Collaboration means working on a project with multiple people using Git + GitHub.
Tips to use during collaboration:
- Use branches for features.
- Push to shared repositories.
- Pull updates often to stay in sync. Example of a code to run from the terminal. > # get latest changes from others git pull origin main
3. Merge conflicts.
Conflicts do occur when two people change the same line in a file, or add conflicting changes especially during collaboration.
How to resolve conflict when it occurs:
- Git shows <<<<<<<, =======, >>>>>>> in the file.
- Manually edit and choose the correct content.
- Mark resolved Example of a code to run from the terminal.
git add filename
git commit -m "Resolved conflict"
4. Code review.
When teammates during collaboration review your pull request before merging:
- Comment on code.
- Suggest changes.
- Approve or request changes. Code review is used for:
- Maintaining quality.
- Learning from feedback.
- Catching bugs early.
5. GitHub Issues
Track bugs, features, or tasks in a project.
Use:
- Title + description to explain the issue.
- Assign team members, add labels, or link PR Example.
Title: Fix login bug
Description: When a user enters the wrong password, the app crashes.
6. Git Commands.
The following are GitHub commands:
-
How to clone a repo
git clone git@github.com:user/repo.git
-
How to check status:
git status
-
How to create a branch:
git checkout -b feature-xyz
-
How to switch from one branch to another:
git checkout main
-
How to add changes:
git add
-
How to commit changes:
git commit -m "message"
-
Pull updates:
git pull origin main
-
How to push changes:
git push origin branch-name
Top comments (0)