Am 08.07.2012 17:43, schrieb pbGit:
Just tried starting again on my local machine because when I tried pushing,
git said that it local was also set to bare init. When I looked this was
the case. Silly me.
So I deleted on my local and added a single file and when I try pushing this
I get the following:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'paul@localhost:/Users/paul/<prject>'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
When I try and pull I then get the following:
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
I then addded my repo with the following command, but this is the wrong
syntax!!!
git pull --repo=<project>
What the hell am I doing wrong???
This is the moment where you have to begin reading man pages, i.e. "git
fetch", "git help pull", "git help remote" "git help push" (read the
examples as they show typical use cases) or preferably read about it in
books like Pro Git (git-scm.com/book/) or tutorials.
For example the --repo parameter in "git push --repo=<project>" doesn't
exactly do what you think it does. It only sets the default remote repo
from "origin" to <project>. Normally you would just use "git push
<project>". And the equivalent pull command would be "git pull <project>".
Naturally you can configure that git pull or git push will just do what
you want, but for that you need to know what a refspec is and how to use
"git remote".
Generally git pull and git push are not complementary. Neither in effect
nor in parameters they take.
For example assume you have just cloned a remote repository. This will
add configuration that connects both repositories and adds a default
remote repo named origin and adds default refspecs
"git pull" without parameters will then fetch all remote branches into
correpondingly named local remote tracking branches (under
.git/refs/remotes/, do a git branch -a to list them too), but then only
merge one of them with the branch you are in at the moment.
But "git push" will push *all* your local branches into branches of the
same name on the remote repository.
Another difference: If you pull, the merge might fail because of merge
conflicts and you have to manually merge conflicting files. If you push,
this manual merge is not possible so usually only trivial merges called
fast-forward-merges are allowed. That is what happened on your push
Something like "git remote add -m master origin <urlofyourrepo>" does
the same configuration as a "git clone" would do and would allow you to
just use "git pull" without parameters.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html