How Do I Update the Branches in a forked Repo - github

I have a master repo 'TestRepo-R' where a new branch was added called v2. I have previously forked this repo into my personal repo, and all the branches are up to date on github (not doing this locally). How do I update my personal fork to have the new branch that was added 'v2' so I can pull it into my local.
Note: I do not have write access to the TestRepo-R.

Related

How to update the branched forked repo?

How can I update a repo on github using git bash which is forked and after fork I have created another branch on it.
I want to update that branch.
I have create a branch locally with the aim of pushing to your remote fork.

"Disconnect" forked Git repos in VSTS

In VSTS, I forked a repository to develop a separate product from the original repo.
When I make a PR from a branch into master in my forked repo, VSTS defaults to merging into the original repo. I have to be sure not to mistakenly merge into the original repo with every PR.
VSTS seems to think that I may want to merge changes from my forked repo into the original one. I have no plans to do so. How do tell VSTS to 'disconnect' my forked repo from the original?
No, there isn’t such feature in VSTS, there is the user voice that you can vote: Allow option of converting forks to repos
Work-around
As a work-around (in Visual Studio) until it's fixed:
Pull the repo.
Delete the remote repo.
Create a new remote repo with the same name.
Push the repo.
You might have to create a temporary remote repo (named temp if you'd like) in order to be able to delete the remote repo. You can delete the temporary remote repo, named "temp", after you've pushed to the new remote repo.
You'll most-likely break anything (pull requests, work items) linked to the repo and also have to re-apply any policies and security stuff.
repo = the faulty fork in VSTS.
temporary remote repo = a temporary tepo created if you cant delete the fork repo.
new remote repo = the new repo to be used instead of the fork.
It seems like one should disconnect the old remote origin and set the upstream before pushing. Maybe the push with the --set-upstream overwrites that?
Here's what I'm did:
git clone ACCOUNT#vs-ssh.visualstudio.com:v3/ACCOUNT/PROJECT/FORK-NAME NEW-NAME
git remote rm origin
Create the new repository on VSTS for NEW-NAME
git push --set-upstream ACCOUNT#vs-ssh.visualstudio.com:v3/ACCOUNT/PROJECT/NEW-NAME develop
This worked for me to change from a fork to a repo. I can see the full history and open changesets from the web viewer. I did this in Azure DevOps (formerly Visual Studio Team Services AKA VSTS). I did not test against GitHub.
Pull requests and pushes are lost. Commits are still linked
I'm not sure if you need to do the push multiple times for different branches. My fork only has a develop branch anyway. I only create a master branch so git flow doesn't complain.

Checking out a github release in Eclipse egit?

How do I set egit to pull a release from github, rather than just the master?
I'm looking to checkout a release 0.4.0.
In the attached, the item checked out isn't pulled from remote - in properties the rebase, remote and upstream branch aren't set. I got this checkout from the tags, but it isn't correct.
You have already checked out the right commit: the head of your current branch v0.4.0-branch is the commit 23d3472 that is tagged as v0.4.0.
In Git a tag references a commit, not a branch. One commit can be in or even the head of multiple branches. For a release, a tag instead of a branch is usually used if the release is not intended to be maintained. Instead, contributions are welcome on top of the latest stage/commit of a specific branch (to avoid merging or rebasing), mostly on the master or on a dev(eloper) branch.
In your case, to contribute to VCVRack/Rack:
In GitHub fork the VCVRack/Rack repository (assuming you are not member of this project)
In Eclipse clone the forked GitHub repository
In Eclipse commit and push your proposed change as a single commit to the master branch of your forked GitHub repository (currently, there are 177 commits to master since the v0.4.0 tag)
In GitHub create a pull request based on this commit

Updating forked GitHub repo to match original's latest code and commits

I forked a GitHub project several days ago and from its issues, I can see that the master branch has had some modifications since.
When I cd to my location directory of this project and use git pull, it says, "Already up-to-date". Why?
How do I update my fork to include the commits from the original repo?
When you fork a repository, a copy of the original repository is established on your GitHub account. This permits read+write access to the "copy".
When the original repository resource has commits that would benefit your copy, follow these steps to update your fork's master branch. You could update other branches, but typical workflow is to update master against the original repository.
Open a Terminal
cd to your project directory
git remote add upstream <url-of-original-repository>
git branch and verify you are on master branch
git pull --rebase upstream master
Step #5 will fetch all new commits of the "original" repository, apply them to master branch from the last merge-base, then include all of your branch's commits "on top".
Any time you need to update your fork again, simply run the command in step #5.

New to github. Fork or branch?

I'm new to github. I just downloaded the Windows GUI github version. I want to contribute to someone's project. Should I fork the original repo to my repo and start from there or should I branch off from the original repo? How do I merge it back to the original repo later? How to do this on the GUI or do I need to use Git shell?
Unless the original author lets you push to his repo, you won't be allowed to do it. The usual process to contribute to a project you don't own is to:
create a fork of the repo
clone the fork you've just created to work on it locally
create a branch to add your contribution
add commits to this branch
push it to your forked repo on github
send a pull request to the original repo on github so that the author can fetch the branch from your repo, test it, and integrate it if he likes it.
This is explained when you click on the giant 3 - Fork a repository link on Github's home page