On my local git repo, I used to push it to two different remote repo, one on github and another on heroku. Now my local is stuck on heroku repo and I want to create a branch from github master branch. How can I change from heroku to github(origin)?
[thi is what my terminal looks like]
See here - you want to set your local branch to track a different remote: Make an existing Git branch track a remote branch?
Related
Is there any way we can move a particular branch from bitbucekt repository to Github repository?
Is there any way Bitbucket repository can be moved to Github without moving the commit history(without removing the git folder and re-initializing the git)
You can add multiple remotes to a repository with git remote add. Once a remote exists, you can push whatever you like to it.
In this case, you can push the branch named newbranch to a new GitHub-hosted remote by doing something like this:
git remote add github https://user#github.com/owner/repo
git push github newbranch
This will include all commits associated with that branch, because that's how Git works. (If you just want to give somebody a copy of the code that doesn't include any history, then you should use git archive instead.) It will not automatically update the GitHub version with changes made on Bitbucket or vice versa, though you can push updates manually or with a script.
I am new to git and egit. First thing i did was i clone one git repo. Now when I switch to git repositoy view in eclipse, I can see Local and Remote Traking folder under branch. I am not sure what is the purpose of Remote tracking here ?
The use of remote tracking branch in EGit is the same as in the command line Git:
Under Local all local and under Remote Traking all remote branches are listed. You can only work on a local branch and in a remote branch, you can see the history (until the last fetch) from the remote repository.
A typical use case is to check out a remote branch as a new local branch. The upstream branch of the newly created local branch is then the remote branch from where you created the branch.
The fetch command is to update your remote tracking branches only.
The pull command gets, in addition, the fetched changed into your current checked-out local branch.
I have a movile project repo in bitbucket and I cloned that repo into a eclipse project the remote branch master/origin point too that repo this is ok, but I created another empty repo in bitbucket and I want to push my project in that empty repo.
My problem is that when I do git remote -v it shows the name of the branches of the repo from were I cloned the project, I want to remove those branches and change them to use the branches of the new empty repo that I created
You can change remote of the repo to point to a different URL:
git remote set-url origin git#bitbucket.org:<your_id>/<new_repo.git>
I finished coding a website in my local computer. Now need upload it to one branch github repo. like https://github.com/xxxx/test.git branch 001
Can you tell me how to commit it in the repo branch
I have already create a local repo commit all files into it by Netbeans. So How can i push the local repo to remote repo branch?
Thanks
When you locally create a branch Git automatically takes care of creating a new branch on the remote server. Just normally do
git push
It will create the branch on the remote server.
Can we switch to different remotes in github I have two remotes
upstream (main repo)
origin (mywork)
Accidently, i created clone of upstream and created branches and worked in it. I want to miove all changes made to upstream's test branch to origin and also switch to origin. Now when ever I create a branch it is created in origin
Please suggest.
Considering those are the same repo (or at least repos with a common history), you can:
clone the other GitHub repo 'origin' 'mywork'on your computer
add the first repo (the 'upstream' cloned one locally) as a remote (git add remote upstream file:///path/to/main/repo)
fetch everything and create local branches out of the remote branches
push everything back to your origin 'mywork' repo