Quantcast

Change git remote, push new branches?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Change git remote, push new branches?

Ben Caradoc-Davies
Justin,

I have a couple of git questions and I am hoping for some best-practice
guidance:

(1) If I cloned from my forked personal geotools repository but now want
to change my local master to track the main geotools repository, what is
the right way to change my local master? Just delete it and recreate it
from the new default remote like this?

git branch -d master
git checkout -b master geotools/master

Does this fix the remotes to be equivalent to a fresh clone? Or will
this have unanticipated side-effects?

(2) I got all the new branches from the geotools repo with "git fetch".
What is the right way to push branches into my forked personal remote on
github? Check them out and then push them? Is their an easier way to
mass-update a forked personal repository with upstream branches? Is
there any reason to do so?

(3) Does a forked github repository have any concept of remotes, and any
tools for acting on them from the web interface?

Trying to merge into my mental model.  :-)

Kind regards,

--
Ben Caradoc-Davies <[hidden email]>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Change git remote, push new branches?

Justin Deoliveira


On Wed, Jul 4, 2012 at 10:08 PM, Ben Caradoc-Davies <[hidden email]> wrote:
Justin,

I have a couple of git questions and I am hoping for some best-practice guidance:

(1) If I cloned from my forked personal geotools repository but now want to change my local master to track the main geotools repository, what is the right way to change my local master? Just delete it and recreate it from the new default remote like this?

git branch -d master
git checkout -b master geotools/master

Does this fix the remotes to be equivalent to a fresh clone? Or will this have unanticipated side-effects?

hmmm.... well if you are always explicit about specifying a remote (like i am) then it doesn't matter since the master in your repo and the master in canonical are the same branch because they have the same history. But i guess my answer would be to clone the canonical repo directly, checkout master, 2.2.x, 2.1.x, etc... then they will be created from canonicals remotes. I am sure there is a nicer way to do this but i have never done it.

(2) I got all the new branches from the geotools repo with "git fetch". What is the right way to push branches into my forked personal remote on github? Check them out and then push them? Is their an easier way to mass-update a forked personal repository with upstream branches? Is there any reason to do so?

I don't ever use git fetch directly. Git pull is a "git fetch" + "git merge" all in one. I find it easier and safer to just always use pull. As for mass pulling / mass pushing I imagine there is probably a way but myself i never do that. I always just push/pull a branch explicitly. I never push the primary branches (master, 2.2.x, etc...) to my fork, only feature branches so i don't really ever keep them up to date. And vice versa. I don't ever push feature branches to canonical so i don't find it necessary to sync up that way either. 

(3) Does a forked github repository have any concept of remotes, and any tools for acting on them from the web interface?

A remote repo on github has no notion of a "remote". A remote is just in your local repository and are just pointers to remote repositories.  

Trying to merge into my mental model.  :-)

Hope that helps :) Someone more versed in git theory would probably give better answers. 

Kind regards,

--
Ben Caradoc-Davies <[hidden email]>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre




--
Justin Deoliveira
Enterprise support for open source geospatial.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Change git remote, push new branches?

mbedward
On 5 July 2012 14:20, Justin Deoliveira <[hidden email]> wrote:

>
>> (2) I got all the new branches from the geotools repo with "git fetch".
>> What is the right way to push branches into my forked personal remote on
>> github? Check them out and then push them? Is their an easier way to
>> mass-update a forked personal repository with upstream branches? Is there
>> any reason to do so?
>
>
> I don't ever use git fetch directly. Git pull is a "git fetch" + "git merge"
> all in one. I find it easier and safer to just always use pull.

Like Ben, I used git fetch to get the branches that were not yet known
by my local repo or my developer fork because I thought that for such
a situation you are not merging into anything and so wouldn't use git
pull. Rather you just want to get the refs to the new branches so that
you can then do a checkout and push to fork on each. But maybe that's
just a round-about way of doing the same thing.

Michael

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [ExternalEmail] Change git remote, push new branches?

Ben Caradoc-Davies
In reply to this post by Ben Caradoc-Davies
On 05/07/12 12:08, Ben Caradoc-Davies wrote:
> (1) If I cloned from my forked personal geotools repository but now want
> to change my local master to track the main geotools repository, what is
> the right way to change my local master? Just delete it and recreate it
> from the new default remote like this?
>
> git branch -d master
> git checkout -b master geotools/master

For the record, this worked (had to checkout a detached head first, and
use -D to delete master) but the direct fix is:

git branch --set-upstream master geotools/master

where I had previously added the remote called geotools to point to the
main repo.

Kin

--
Ben Caradoc-Davies <[hidden email]>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [ExternalEmail] Change git remote, push new branches?

Justin Deoliveira
On Wed, Jul 4, 2012 at 11:54 PM, Ben Caradoc-Davies <[hidden email]> wrote:
On 05/07/12 12:08, Ben Caradoc-Davies wrote:
(1) If I cloned from my forked personal geotools repository but now want
to change my local master to track the main geotools repository, what is
the right way to change my local master? Just delete it and recreate it
from the new default remote like this?

git branch -d master
git checkout -b master geotools/master

For the record, this worked (had to checkout a detached head first, and use -D to delete master) but the direct fix is:

git branch --set-upstream master geotools/master

where I had previously added the remote called geotools to point to the main repo.

Nice git fu Ben! I will have to remember this one.
 
Kin


--
Ben Caradoc-Davies <[hidden email]>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre





--
Justin Deoliveira
Enterprise support for open source geospatial.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Loading...