I am not using github. We have git setup on our machine.
I created a branch from master called experiment. However when I am trying to do git pull I am getting following message.
> git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.experiment.merge' in
your configuration file does not tell me either. Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
Here is result of git remote show origin
> git remote show origin
* remote origin
Fetch URL: ssh://git.domain.com/var/git/app.git
Push URL: ssh://git.domain.com/var/git/app.git
HEAD branch: master
Remote branches:
experiment tracked
master tracked
Local branches configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
experiment pushes to experiment (local out of date)
master pushes to master (up to date)
As I read the message above experiment is mapped to origin/experiment. And my local repository knows that it is out of date. Then why I am not able to do git pull?
This is how I created this branch
git co -b experiment origin/experimen
t
One explanation would be that the latest commits have been done on another branch, as explained in "Git pull from my public repository not working". The other possibility is for you to be in a detached HEAD mode. That would make any git pull "up-to-date" since you are in any branch.
How to Fix error: failed to push some refs to Error in Git Using git pull --rebase. The git pull --rebase command is helpful in situations where your local branch is a commit behind the remote branch.
git pull Not Updating Files Due to Uncommitted Files in Your Local Repository. As a source code management system, Git does its best to prevent you from losing your files and data. For this reason, Git may refuse to merge your local files with files from your remote repository when performing the git pull command.
git pull --force it feels like it would help to overwrite local changes. instead, it fetches forcefully but does not merge forcefully ( git pull --force = git fetch --force + git merge ). Like git push, git fetch allows us to specify which local and remote branch we want to work on.
Pull:
git pull origin experiment
Push:
git push origin experiment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With