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>
Related
I created a new repository on github, modified the default readme file and then created a development branch to work on my project.
I have successfully commited and merged on development branch after it, sending all local modifications to github.
But when I try to push my local modifications to the master branch, XCode returns the following message:
The local repository is out of date
Make sure all changes have been pulled from the remote repository and try again.
And if I try to pull the changes..
How can I correctly push my project to the master branch?
You must do a git pull before you push to the server.
There are updates on the serer which you don't have on your repository.
git pull origin <branch
git push origin <branch>
When you try to push git verify that the latest commit from the server is in your local branch. if it does not - if you don't have it locally yo will be asked to pull the changes form the server before you can push your updates.
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
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
simple example,
1)made a new project
rails new test_app
2) git commands
git init
git add .
git commit -m "init"
git push origin master
ok finished!
now after this, if i look at github.com webpage gui.
it doesn't show my repository.
How can i set this to my github webpage?
First of all you need to create an repository on github. After that you need to create an ssh key with github for your pc. Befor you can push to the master branch you need to add the remote repository:
git remote add origin git#github.com:yourrepo.git
Than push "origin" to the master branch.
I make some changes in local files, how can I deploy the new version?
if I type git push heroku master, it's say everything up to date, but the application wasn't changed.
You probably need to commit your changes first.
Run git commit -a -m "updated some files"
then run git push....
So you’re on a git repo with a remote repo named heroku?
Did you commit your changes, and afterwards push?
They have to be commited locally so you can push them.
When you clone a repository with git the remote repository you cloned from will be added as “origin”, then a simple git push will push to the origin.
If that’s not the case, you can use the name of another/your remote repository you added first, or it’s URL.
Also see the doc for git push: http://www.kernel.org/pub/software/scm/git/docs/git-push.html