How can I create
I created a new rails app with the command rails new. There is a private repo in Github XYZ which I have access to. I forked the private repo XYZ, now how do I connect the new rails app with this private repo and create a new branch where I can work on?
Typically if you are wanting to work on a repo branch then you would fork the repo and pull down a copy. From there you would branch and do your work.
If however you do want a separate branch with a new rails app you can set the remote
git remote add origin git#github_repo:repo_fork
then you can push your branch to your fork like:
git push origin branch_name
Related
I'm trying to use git on an existing Xcode project by making a remote repo, but I can't push to it. I get this error: "The remote repository rejected commits. Make sure you have permission to push to the remote repository and try again." . I'm unsure why git makes the remote repo, but does not allow me to push. Could it be that my Xcode project is too large for the initial push?
The problem shouldn't be that your Xcode project is too large. You most likely are not allowed to push on the "master" branch because it is a protected branch. Is this your own remote repo or is someone else the owner?
If you want to push to the remote repo immediately, you can create your own branch off of master (if you are currently in the master branch) with
git checkout -b <branch_name>
To learn more about GitHub protected branches, check out GitHub Protected Branches
I have an android project in a bitbucket Repo (lets call it repo A).
I have to create a new android application which is quite similar to old android application and further modifications. For this new android application, I want a new bitbucket repo.
I have created a new bitbucket repo (lets call it repo B)
At the moment repo B is empty.
Now I want to copy all the code files of repo A to repo B. So that I can do further android development in repo B.
During all this process, I want to keep repo A intact.
Please advice how it can be achieved.
Two possible approaches here.
If you want Repo B to be able to receive future updates from Repo A, then it's easiest to fork Repo A. Repo B will then have its own permissions, CI/CD setup, and so forth, but Repo B will start as a full clone of Repo A and you'll be able to sync any new changes between the two as necessary.
If you don't want that, then you can push whatever code you want from anywhere up to repoB. It might be easiest to do something like this on your local system:
cp -rp repoA repoB
cd repoB
git remote set-url origin git#bitbucket.org:owner/repoB.git
I have a github repository called A. It's connected to heroku-A and the website is up and running. I did changes locally to the code, but I don't want those changes to show on repository A or heroku-A. I want to push the code to a totally new repo. How can I do this?
Here would be the procedure:
Create a new git branch (so that code is separate from your other repo)
git checkout -b <new_branch>
Add a remote pointing to your new repository
git remote add <new_repository_url> <new_repository_name>
Push the new branch to the new repository:
git push <new_repository_name> <new_branch>
I have an issue understanding the work flow on GitHub.
First I fork someones repository.
I clone the repository locally( on my computer)
I create a branch called Sample101 and make changes
I push branch Sample101 to my GitHub account
I create a pull request
The person I created a pull request Merges Sample101 Branch to his Master Branch.
The question is, How do I update my forked/clone after that person merges/updates his master branch? I just want my master copy to be up to date.
In your local repository cloned from your Github repository (which is the fork you have push rights), add the remote for the original repository
git remote add upstream <original remote url>
Now pull, or fetch merge, whichever you're more comfortable with
git checkout master
git pull upstream master
Now push up to your fork
git push origin master
Rails/Heroku/Git newbie - here is my question. I have an app deployed with Heroku and am using the git repository hosted there as the only remote copy of my local work. I start making changes locally on a new branch and want to make this branch available on Heroku so that I can continue work on it from another computer. Heroku ignores branches other than master and I don't want to merge my changes yet (or push them as master). Is there a way to store/access my new branch via my Heroku git repository, or is it better to have another remote git repository for my work in progress.
Thanks!
You can push a local branch to the remote git server with:
git push origin branch_name
That way, you can pull it down again elsewhere with:
git checkout -b branch_name origin/branch_name
http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html
http://gitready.com/intermediate/2009/01/09/checkout-remote-tracked-branch.html
I would go with a separate git repository as suggested - github.com or similar. Store your code there and deploy to Heroku's master repo - Heroku is a hosting platform afterall not a home for your repos.
ALTERNATIVELY Make use of dropbox and create your local workspace in a dropbox folder that is synced across multiple computers - I employ this method as well as git - plus you get the advantage that Dropbox is versioned so if you delete/change a file that you haven't committed yet you can get it back.