Re: Where/how to create tracking branches?

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

 



On Monday, February 19, 2007 at 11:43:36 (-0800) Junio C Hamano writes:
>...
>Assuming your clone was initially made from /public/repo/project,
>doesn't "git fetch" without _any_ parameter work?
>
>	$ git fetch

Short answer: yes, it does.  I had assumed I needed to create the
tracking branch somehow since I created the topic branch in the first
place in my private repo.  More detailed confirmation follows, but
thank you for pointing out that git is in fact smarter than I gave
it credit.

# set up a public repo with "master" branch and something in it...
mkdir public_repo && cd public_repo && git --bare init
cd ..
mkdir a_repo && cd a_repo && git init
echo A > A && git add A && git commit -a -m A
git push ../public_repo master:master

# clone public repo to get my private repo, create topic branch
cd ..
git clone public_repo private_repo
cd private_repo
git checkout -b topic
echo change >> A && git commit -a -m change

# publish my branch 'topic' to my public repo
git push ../public_repo topic:topic

# A peer grabs the topic branch, makes changes and pushes back to public
cd ..
git clone public_repo peer_repo
cd peer_repo
git checkout -b topic origin/topic
echo more >> A && git commit -a -m more
git push ../public_repo topic:topic

# Go to my private repo, pull latest changes (show output this time...)
cd ../private_repo
git checkout master
git pull
remote: Generating pack...
remote: Done counting 5 objects.
Result has 3 objects.
remote: Deltifying 3 objects.
remote: /3) done/3) done
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking 3 objects
 100% (3/3) done
* refs/remotes/origin/topic: storing branch 'topic' of /home/blear/test/public_repo
  commit: 4a8e157
Already up-to-date.

# Now, switch to topic branch
git checkout topic
cat A
A
change

# Ok, now I get it:
git diff origin/topic
[changes listed]
git merge origin/topic
cat A
A
change
more


Bill
-
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]