Reputation: 1002
i am working on master branch cloned by command git clone -b master [email protected]:/home/github/jobsite
where [email protected]:/home/github/jobsite
repository contains a lots of branches
i usually do git pull
and git push
to pull and push my works.
now as i want to merge branch forum
into master
.
so i cloned the branch by command git checkout --track origin/forum
, and merged it with master.
now the problem is git push
& git pull
is not working correctly?
Upvotes: 2
Views: 2282
Reputation: 60275
From the git manpage:
The special refspec : (or +: to allow non-fast-forward updates) directs git to push "matching" branches: for every branch that exists on the local side, the remote side is updated if a branch of the same name already exists on the remote side. This is the default operation mode if no explicit refspec is found (that is neither on the command line nor in any Push line of the corresponding remotes file---see below) and no push.default configuration variable is set.
As I recall, this default will change, you're not the first person who didn't expect this. If you think about it, though, it's the default you'll usually wind up explicitly configuring, because you very rarely want to mistakenly push every private branch to a shared repo.
Once you've pushed the branch explicitly, once, the default push will work.
Upvotes: 1
Reputation: 9681
You need to specify which branch to push and pull from since you have master and forum
git pull origin forum/master
git push origin forum/master
Upvotes: 2