Shukant Pal
Shukant Pal

Reputation: 730

Forking in GitHub - Mainline Commits

In Github, when a fork a repo all the content's get copied to a new fork repo. I want to know if a commit happens in the original repo then can I also have that happen in the fork. If so how can I do so?

Also is it possible to change the name of the fork?

Upvotes: 2

Views: 67

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24156

You can download the original/repo. Then create a new/repo (with the downloaded file) in your personal account with a different name as you want. Then go to new/repo.

$ git remote add upstream <original/repo/url>
$ git fetch upstream

$ git diff HEAD..upstream/master       # compare between HEAD and origin-repo-master if any change occurs 

# you can also pull original-repo-master-branch in another branch here and see the commit lists
$ git checkout -b <test-branch>
$ git pull upstream master            # pull upstream(original repo) master into local `test-branch`

$ git log                             # see the commit lists 

# You can take an original-repo-commit by `cherry-pick` manually. Copy the `commit-hash` from `git log`

$ git checkout master
$ git cherry-pick <commit-sha>        # take the original-repo-commit manually

Upvotes: 1

Related Questions