Github to launchpad sync - github

I am working on a open source project which uses bazaar for versioning and launchpad for repo. The project also has github repo but launchpad repo is primary. I am behind college proxy so i can't access ssh required to connect to launchpad to merge/push changes. Is there a way, that i commit, push all changes on my github account, and they get reflected on my launchpad account too. Can I send merge requests too?

This will give you overall idea , how to do that
create your project test in github and will be owned by organization name Acc.
then just push the master branch to test
Now fork the project and clone
Push all your local branches to your GitHub fork git push -a origin
And checkout that branch using git checkout <branch_name>. And then push to origin of that branch.
Launchpad is a project-centric environment, so you will most likely have a GitHub organization that owns the ‘main’ repository and encourage all members and newcomers to fork from that.
within fork developer can able to work on that, usually when about to issue a pull request – GitHub’s version of a merge proposal, pull down changes from the upstream organization master into their master. Since this will happen relatively often it is easiest to add an additional ‘remote’ target for it:
git remote add acc `http://github.com/acc/test.git`

Related

Bitbucket to github migration of an already existing repo

we have migrated from bitbucket to github 4 months ago but our team members are still using bitbucket. So, now we have decided to completely moved to Github and use its sevices. So, i want to know whether we can still use mirroring or not to migrate all the changes in bitbucket to github or we have to push it manually or using git push --all.
It depends if there was concurrent activity both on GitHub (the new repository) and BitBucket (the old one)
If that is the case, I would prefer asking each developer, in their own local repository, to:
add the new repository as a remote 'gh'
fetch from it
rebase their branch on top of gh/their-branch (for branches that were modified both on GitHub and BitBucket)
push new branches (done only on BitBucket)
That way, each developer can resolve any conflict locally first, before updating the new GitHub repository.

"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.

Unable to git push julialang

I'm trying to get the latest julia master commit.
I instaled it via git clone, however, when I do
$ git push
It returns an exception:
fatal: remote error: You can't push to git://github.com/JuliaLang/julia.git
Use https://github.com/JuliaLang/julia.git
If I use the option given, git requires me a password.
It sounds like you probably don't actually want to push to the JuliaLang repository, but rather pull from it.
You git pull to fetch upstream changes and integrate them into your local repository. So, for example, to update and rebuild Julia, you would git pull && make clean && make from within julia's directory while on the master branch.
You would only git push if you were a contributor submitting changes. But even among contributors who have commit access, very few actually push directly to the master branch. Most create branches, submit those, and then open a pull request for a review. And for that workflow, you don't even need to be a contributor. You can "fork" the project on Github, and then push to your forked repository online. From there, you can open a pull request for review.
git:// doesn't allow for authentication.
ssh or https does.
In the case of https, it is asking for your GitHub username and password.
See more at "Git - the Protocols".
GitHub needs to know who you are, because only the owner (or a collaborator) has the right to push (while everybody can clone/pull from a public repo, which is why git:// works for cloning).
See "Permission levels for a user account repository".
Note: here github.com/JuliaLang is an organization, which means only the owner and members/teams can push to a repo declared in that organization.
Se more at "Permission levels for an organization repository".

Syncing a fork on github with Plastic SCM

I've been a great fan of Plastic SCM for a while now, using it locally for my own personal projects. Lately I've decided to contribute to an open source project on github. Since Plastic SCM can be used as a github client I decided to use it as such.
Now this is my first time using github, so I followed the classic github workflow as described in all the tutorials:
Fork the repo to get your own copy
Sync the Plastic SCM repo with the personal github repo
Commit changesets in Plastic SCM
Sync the Plastic SCM repo with github again
So far everything went fine. I contributed my code, uploaded it to github and saw all the changesets and branches appear in the github webui.
Next I put in a pull request to the original repo I forked from. This is where my problems start. The pull request was accepted, and a new changeset appeared in the original repo which contains my pull request. It seems all my intermediate branches did not transfer to the original repo either.
As shown in the network graph above, the original repo (purple) is now no longer in sync with mine. I started with further development in another branch (VEH003) but this one seems to be completely disconnected from the original repo (purple).
In my Plastic SCM client I can see exactly the same network graphs in the branch explorer, with the exception of the purple branch.
I read that to update your fork with the changesets from the original repo this has to be done explicitly, and in your local git repository (github help). Now I don't know how this is done using Plastic SCM.
To sync your local fork with the original repo, as described in the github help, you need to merge the upstream master branch with your local master branch.
The point here is that Plastic SCM does not track or sync the upstream references (the references of the original repo), just your github's repo references.
To be able to update your fork, and continue working with Plastic SCM you should use the command line git client to perform the update following the guide you linked, push the local git changes to your github repository and then sync Plastic SCM with github to get the changes. Step by step:
Use the git client to clone your github repository
git clone your-fork-url
Add the upstream repository.
git remote add upstream original-repo-url
Fetch the upstream references.
git fetch upstream
Merge upstream changes to your master branch.
git checkout master
git merge upstream/master
Push master branch to your github repository.
git push origin master
Sync Plastic SCM with your github repo.

Fork from a branch in github

Is there a way to fork from a specific branch on GitHub? … For example, moodle has many branches (1.9, 2.0 … and so on). Can a clone be performed of just branch 1.9 and not the master branch always? Is it possible to clone a specific branch onto my PC?
I don’t know a native way yet, but you can do it following this recipe:
Fork the repository in question (called ‘upstream’) on the GitHub website to your workspace there.
Run the GitHub desktop application and clone the repository onto your PC.
Use the GitHub desktop application to open a shell in the repository. (The git commands are not available from the default PowerShell unless you configure that manually.)
Set the source repository as upstream:
git remote add upstream https://github.com/{user}/{source-repo}.git
Fetch the full upstream repository. (Right now, you only have a copy of its master branch.)
git fetch upstream
Make your file system copy the branch you want and give it any name:
git checkout upstream/{branch-in-question}
git checkout -b temporary
Publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
Change the “Default branch” to ‘temporary’. (Just change the drop-down menu, you don’t need to click the “Rename” button.)
Go back to your repository, go to the ‘branches’ tab, now you can delete the “master” branch.
Delete the master branch on your shell and make a new master branch:
git branch -d master
git branch master
git checkout master
git -d temporary
Once more, publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
Change the “Default branch” back to the (new) ‘master’ branch.
Go back to your repository, go to the ‘branches’ tab, now you can delete the “temporary” branch.
This should be what you were looking for. Perhaps GitHub will provide a more convenient way to do this in future (e.g., clicking “Fork” from a project’s branch results in exactly this behaviour).
Cloning means that you create a copy of the whole repository in your account including all branches and tags. However you are free to switch and track branches however you like.
No command line needed. Just create a new branch in your forked repository in GitHub. GitHub will ask you if you want to clone/mirror this new branch from the upstream repository. You can give any name to the new branch.
Yes, you can clone the single branch. For example, you have a branch named release1.0. If you would like to clone this branch into your pc then use the following line of code:
$ git clone git#bitbucket.org:git_username/git_repository_example -b release1.0 --single-branch
For those who don't like working with command-line. Here is a simple guide using the desktop client for GitHub:
Click the fork button of the repo on GitHub.com:
Make sure you have the desktop client installed
Click this button:
Clone the repo
In the desktop client, select the desired branch
Select the branch you'd like to work on and you're done
I'm posting here the method I've used.
Like the OP I wanted to only copy/fork one branch. But couldn't find an easy way.
in your repo create a new branch. It doesn't need to have the same name as the branch you want to fork
once created, verify that it is the selected branch, and click "Compare"
reverse the order of comparison (I have a userscript for that, see my profile if it's something you want to test).
the "base" repository must be yours, with the branch you've created
the "head" repository is the original, and the branch is the branch you want to fork
hit "create pull request" and continue until the PR is applied
That's it. You have the branch forked.
I'm using bitbucket but I'm sure this would work for GitHub as well.
Create a new repository
Checkout the branch using GitExtensions
Click Push to open the Push dialog
Set the destination URL to the new repository
Set the destination branch to "master"
Push
Your new repository will have the full history of the one branch only (not all branches like forking will have).
A fast, alternative approach is to create your own new repo.
Go to https://github.com/new and make a new repo. Do not initialize with README.
Scroll down to get your git remote
Then:
git remote rm origin
git config master.remote origin
git config master.merge refs/heads/master
// Run code from above image
git push --set-upstream origin yourbranchname
You will have a new repo with the original repo's code and a branch that can be made into a pull request.
SOLUTION:
For remote repository on GitHub and local repository
After fork all branches to your GitHub repository, you can delete Redundant branches in your GitHub repository.
And then you can only clone the branches you need to local.
Step One
Step Two
Only For local repository
git clone -b <branch name> --single-branch <repository>
If you want to further save your disk space, you can clone remote repository without history:
git clone -b <branch name> --depth 1 <repository>
notice: --depth implies --single-branch unless --no-single-branch is given.
https://git-scm.com/docs/git-clone
Switch to the branch you need in source repo
Click "Fork". You'll get forked master and the branch you're in.
I don't know how it works with more branches, but for my needs worked pretty well.