DEV Community

Chemutai Brenda
Chemutai Brenda

Posted on • Edited on

DAY 2 OF LEARNING DJANGO.

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:

  1. How to clone a repo

    git clone git@github.com:user/repo.git

  2. How to check status:

    git status

  3. How to create a branch:

    git checkout -b feature-xyz

  4. How to switch from one branch to another:

    git checkout main

  5. How to add changes:

    git add

  6. How to commit changes:

    git commit -m "message"

  7. Pull updates:

    git pull origin main

  8. How to push changes:

    git push origin branch-name

Top comments (0)