Why i'm unable to create a branch on remote.I'm using this command git push --set-upstream origin mybranch
There is no error message on terminal. It asks for email and pass. But when I refresh github.com. There is no branch other than 'master'
The branch is there in github.Click on the branches link
It is because you are not pushing to the right remote branch. Try -
git push test-1 master
Related
I am new in git and in nodejs. My question is I build a project and uploaded it on github in main branch. But members are asking to to give pull request. How can I make a pull request please tell me full procedure with commands if possible thankyou.
I uploaded on git like this
Git init
Git add .
Git commit -m"initial commit"
Git git add origin main githublink(ssh)
Git push -u origin main
After this my project is uploaded successfully
Now how can I make a pull request
first you need to checkout from the main branch by git checkout
then you develop and code in that branch
next you commit and push that branch on github repo
git commit -m"initial commit"
git add origin <your_branch> githublink(ssh)
git push -u origin <your_branch>
finally you access the github page and your new branch. create a pull request into the main branch. then share that pr to your colleagues.
for example the last step:
when i use git pull command I came with an error as below
You need to have an active & tracking branch to pull from, As of this moment, you don’t have one set up.
To confirm an active & track a branch:
git branch --set-upstream-to=origin/‹branch› main
More Information on git pull:
https://www.freecodecamp.org/news/git-pull-explained/amp/
It seems you are trying to pull from an unknown branch.
You can try pull from master branch
git pull origin master
Or you can pair your local master branch with remote master branch using
git branch --set-upstream-to=origin/master master
After setting upstream, normal "git pull" command will work. You don't have to specify branch name with "git pull".
Essentially, I followed these steps: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request
The only difference is that I used get rebase onto master to sync master into my feature branch. This is my workflow:
git checkout master
git pull
git checkout <my branch>
git rebase onto master
git push -f origin <my branch>
However, when I now go into github to do a pull request, it is showing old commits that have already been merged.
I have a master branch and a featureBranch.
Our companies default is to rebase the featureBranch to the master so that the featureBranch is uptodate with the master.
Then to push the featureBranch to the master
git push origin featureBranch:master
How can I achive this with Sourcetree?
When you push to a remote, SourceTree gives you the option to specify which local branch(es) to push, as well as which remote branch to push to.
I want to push to a branch which is not master. That is what I did:
git init
git add .
git commit -m "first"
git push origin second (second is the name of a branch) but it say
fatal: origin does not appear to be a git repository.
fatal: could not read from remote repository.
Please sure you have the correct access rights and the repository exists.
Last night I could do that and in the morning suddenly it does not recognize my branch! it does not show my branch when I do git branch, it only shows a master branch. But why I experience this problem sometimes?
Thanks :)
First, make sure you are in the right branch: if git branch doesn't list 'second', you can create it:
git checkout -b second
Actually "second" branch exists and I can see it on the github site
Then:
git checkout -b second --track origin/second
(a git fetch origin might be in order first)
Then, make sure the remote 'origin' exists:
git remote -v
And then, push and set origin/second as upstream branch of your local branch second.
git push -u origin second
(See "Why do I need to explicitly push a new branch?" for more)
try
git pull origin master
before
git push origin master
I had the same error and it worked for me.