DEV Community

Marvin Ochieng
Marvin Ochieng

Posted on

Day 2. Learning about Git and Git and Github

Image description 1. Forking a Repository
Go to the repo on GitHub.

Click Fork (top right).

Clone your fork:
git clone <your-forked-url>

Work on your computer, then push changes to your fork.

  1. Collaborating on GitHub

Image description
Use issues to report problems or suggest ideas.

Assign tasks to people.

Push your code and open a pull request.

Review and discuss changes with teammates.

Communicate clearly in comments.

  1. Creating a Pull Request

Image description

Make a new branch:
git checkout -b my-feature

Make and commit your changes:
git add .
git commit -m "what you changed"

Push your branch:
git push origin my-feature

On GitHub, click Compare & pull request.

Write a title and description, then submit.

  1. Resolving Merge Conflicts Pull latest code: git pull origin main

If there are conflicts, fix them in the files.

Add and commit the fixed files.

Push again:
git push

  1. Code Review Check the pull request.

Review code for quality and clarity.

Leave helpful comments.

Approve or request changes.

  1. Managing Issues Open an issue with a title and details.

Label and assign it.

Comment updates.

Close it when done.

  1. Basic Git Commands
git init # Start git in a folder

git clone <url> # Copy a repo

git status # Check changes

git add . # Stage changes

git commit -m "message" # Save changes

git pull # Update from remote

git push # Upload your changes

git checkout # b branch – New branch

git merge branch # Combine branches
Enter fullscreen mode Exit fullscreen mode
  1. Pushing Changes Update your branch: git pull origin main

Commit your changes:

git commit -m "message"
Enter fullscreen mode Exit fullscreen mode

Push:

git push origin your-branch
Enter fullscreen mode Exit fullscreen mode

Open or update a pull request.

Top comments (0)