Hi Michael,

Having some more time now, here`s a bit more elaborate answer, mentioning 
the rebasing flow, if you prefer that instead.

On Saturday, March 25, 2017 at 2:22:09 AM UTC+1, Michael Gersten wrote:
>
>
> So here is what I'm trying to do. 
>
> "Master", in this case, is the rg3 (primary) github repository of 
> youtube-dl. 
> It gets an update about every 2 days. 
> https://github.com/rg3/youtube-dl.git 
>
> "Dish" is a pull request that adds in support for Dish networks to the 
> Adobe Pass authentication scheme. It works, but is not yet in the official 
> codebase. It comes from 
> git fetch https://github.com/gkoelln/youtube-dl.git Dish 
>
> I am not making changes to either Dish (someone else's code) nor master. 
> I made 'merged-dish' so that I would have something to use without getting 
> the local copy of either branch dirty. 
>
> So, I did 
>
> git fetch https://github.com/gkoelln/youtube-dl.git Dish 
> git checkout FETCH_HEAD 
> git tag -a Dish 
> git checkout master 
> git checkout -b merged-dish 
> git merge Dish 
> make 
> ... 
>

Is there any special reason that you go through hoops of checking-out 
FETCH_HEAD and tagging it, instead of doing straight `git checkout Dish`? 
That should provide a remote tracking local branch "Dish" which you can 
then just keep rebasing on master with `git rebase master Dish` whenever 
"master" gets updated.
 

> All good. 
>
> Two days later, I have to update youtube-dl. So, a pull on master (clean 
> update), and then the question, what's the best way to keep the Dish 
> patches up to date?
>

In case where you previously did `git checkout Dish` to get the remote 
tracking local branch, you would just need to do `git rebase master Dish`  
(or just `git rebase master` if you`re already on the local "Dish" branch).
 

> So, my thinking is to rebase my copy of the Dish patch onto master, and 
> then compile that. 
>
> What actually worked for me was 
> git rebase --onto master master merged-dish 
> I'm surprised that I had to specify master twice, so I really don't 
> understand the arguments to rebase. 
>

I would actually be surprised if the command you wrote would do anything 
useful (with that "master" specified twice), though maybe I`m missing 
something (in case one "master" gets magically translated to something 
else, which I wouldn`t expect, but I don`t know...). And why do you use 
"--onto"? It doesn`t seem to be needed in your case.

So, to wrap this all up, here`s the flow you may follow to keep "Dish" on 
top of "master" in case where you don`t own any of them, and using `git 
rebase` (for the sake of completeness, I`ve started from scratch, 
initializing a new repository):

(*1*) $ git init
(*2*) $ git remote add -f -t master rg3 
https://github.com/rg3/youtube-dl.git
(*3*) $ git remote add -f -t Dish gkoelln 
https://github.com/gkoelln/youtube-dl.git
(*4*) $ git checkout master
(*5*) $ git checkout Dish
(*6*) $ git rebase master


After steps (5) and (6), the graphs should look something like this:

(*5*) ---A---B---C---D---E---F (master, rg3/master)
        \
         Z (Dish, gkoelln/Dish)

(*6*) ---A---B---C---D---E---F (master, rg3/master)
        \                   \
         Z (gkoelln/Dish)    Z' (Dish)


Now your local "Dish" is based on top of latest "master", and all is good.

In the future, each time "rg3/master" gets updated, you can do:

(*7*) $ git checkout master
(*8*) $ git pull
(*9*) $ git rebase master Dish


After steps (8) and (9), the graphs should look something like this:

(*8*) ---A---B---C---D---E---F---G---H---I (master, rg3/master)
        \                   \
         Z (gkoelln/Dish)    Z' (Dish)

(*9*) ---A---B---C---D---E---F---G---H---I (master, rg3/master)
        \                               \
         Z (gkoelln/Dish)                Z'' (Dish)


Once again, your local "Dish" branch is based on top of latest "master" and 
ready to use.

Regards,
Buga

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to