Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 20, 2021 03:26 pm GMT

Simple work with Git Fork

"A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository."

Link for github docs

On the start

We have 2 repos

  • original github/OWNER/original
  • forked github/YOU/forked

In forked repo we can check our settings

$ git remote -v> origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)> origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

On the next we need to add original repo as upstream

git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

Now we should see

$ git remote -v> origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)> origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)> upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)> upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Get changes from original to forked

git fetch upstreamgit checkout maingit merge upstream/main

Creating Pull Request from forked to original

# FORKED repo# make changesgit add .git commit -m "message"git push

Then go to github and create Pull Request.

PR on github

Workflow

To keep workflow clean:

original forked

forked original (do it only when you are sure what are you doing!)


Original Link: https://dev.to/daw888/simple-work-with-git-fork-3cdj

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To