Re: confused about remote branch management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2014-07-23 at 14:41 -0700, Junio C Hamano wrote:
> Ross Boylan <ross@xxxxxxxxxxxxxxxx> writes:
> 
> > I still don't know what I need to do to update origin/master in my local
> > repo.
> >
> > Regarding Kevin's suggestion, I just tried "git fetch origin master".
> 
> I think Kevin's suggestion was 'To older git, "git fetch origin
> master" tells it to fetch master without updating origin/master, so
> it is understandable that your origin/master was not molested'.
> 
> Either
> 
> 	git fetch origin master:refs/remotes/origin/master
Great; that works.
Is that procedure supposed to be the usual way I track upstream in this
(1.7) version of git?  It seems arcane.

I had thought the usual workflow was supposed to be one of 2
alternatives, either
git checkout remotes/origin/master
git pull origin master
git checkout master
git merge remotes/origin/master
But that failed on the first step.  Or

# assuming we are on the local master branch
git fetch origin master
# and everything is updated.

Is the problem that I called the local branch with my modifications
master instead of something else?
> 
> or if you want to be more explicit and unambiguous:
> 
> 	git fetch origin refs/heads/master:refs/remotes/origin/master
> 
> should work on all versions of git.

After studying man git-fetch's discussion of the refspec parameter,
especially the second note: 

	You never do your own development on branches that appear on the right
hand side of a <refspec> colon on Pull: lines; they are to be updated by
git fetch. If you intend to do development derived from a remote branch
B, have a Pull: line to track it (i.e. Pull: B:remote-B), and have a
separate branch my-B to do your development on top of it. The latter is
created by git branch my-B remote-B (or its equivalent git checkout -b
my-B remote-B). Run git fetch to keep track of the progress of the
remote side, and when you see something new on the remote branch, merge
it into your development branch with git pull . remote-B, while you are
on my-B branch.

I'm even more confused.  Is "Pull: lines" a reference to log messages
during the fetch, a configuration file, or something else?  The docs
refer to a pull: line in $GIT_DIR/remotes, but I have no such directory.
I do have .git/config, which includes
[remote "personal"]
	url = https://github.com/RossBoylan/ESS.git
	fetch = +refs/heads/*:refs/remotes/personal/*
[branch "master"]
	remote = personal
	merge = refs/heads/master
[remote "origin"]
	url = https://github.com/emacs-ess/ESS.git
	fetch = +refs/heads/*:refs/remotes/origin/*

Ah!  branch master is associated with the personal remote; is that why
updating it from origin's master branch has no effect on origin/master?

I also don't know what the "." in "git pull . remote-B" does; the
git-pull manpage doesn't indicate it's legal as far as I can see.

Ross

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]