Hi Yegappan!

On Mi, 25 Mai 2016, Yegappan Lakshmanan wrote:

> Hi all,
> 
> I recently started using the github branches to track my changes to Vim.
> I have a question about syncing a feature branch to the upstream repository.
> 
> I first created a clone of the Vim repository:
> 
>     https://github.com/yegappan/vim
> 
> Next, I created a child branch for each of my change:
> 
>     https://github.com/yegappan/vim/branches
> 
> After Bram released several patches recently, I synced my fork to the Vim
> repository.  Now how do I sync (rebase) all of the feature branches?
> 
> When I tried to rebase and push the changes back to one of the child branch,
> it created a commit with all the patches from the mainline. It shows up as
> though I committed all the  changes.
> 
>     https://github.com/vim/vim/pull/830/commits
>     https://github.com/vim/vim/pull/830/files
> 
> What is the proper method to sync (rebase) the upstream changes to the feature
> branches in a fork?

I had problems with this as well, since I switched from mercurial mq 
patches to git. So let me explain what I usually do. I assume, you have 
a branch called upstream, where the remote is the vim/vim repository:

#v+
1 39209 chrisbra@debian ~/code/git/vim-src (git)-[master]- % git remote -v
origin  [email protected]:chrisbra/vim.git (fetch)
origin  [email protected]:chrisbra/vim.git (push)
upstream        [email protected]:vim/vim.git (fetch)
upstream        [email protected]:vim/vim.git (push)
#v-

Now what I do is, I update the master branch first and rebase upstream 
vim/vim on it:

#v+
1 39209 chrisbra@debian ~/code/git/vim-src (git)-[master]- % git fetch upstream 
&& git rebase upstream/master

[...]
* [new tag] ....
[...]
#v-

Now your master branch is at the same state as vim/vim process. Now I 
usually switch branches to the feature I am working on and rebase on top 
of it:

#v+
128 39213 chrisbra@debian ~/code/git/vim-src (git)-[master]- % git checkout 
search_skip
Switched to branch 'search_skip'
0 39214 chrisbra@debian ~/code/git/vim-src (git)-[search_skip]- % git log -v
commit be0e2f5ee9fa786aa71f30fdc7ef41386b1126d4
Author: Christian Brabandt <[email protected]>
Date:   Wed Feb 24 19:48:51 2016 +0100

    Add skip expressions to search() function

    This allows to search for patterns, and skip on certains expressions
    (e.g. skip all matches in comments), similar to how searchpair() works

commit 68c85fcdf31c104db21c96cd5871724e458c95ff
Author: Bram Moolenaar <[email protected]>
Date:   Wed Feb 24 12:57:50 2016 +0100

    patch 7.4.1412
    Problem:    Compiler warning for indent. (Dominique Pelle)
    Solution:   Fix the indent.
[...]
141 39215 chrisbra@debian ~/code/git/vim-src (git)-[search_skip]- % git rebase 
master
First, rewinding head to replay your work on top of it...
Applying: Add skip expressions to search() function
Using index info to reconstruct a base tree...
M       runtime/doc/eval.txt
M       src/eval.c
M       src/testdir/test_syntax.vim
Falling back to patching base and 3-way merge...
Auto-merging src/testdir/test_syntax.vim
CONFLICT (content): Merge conflict in src/testdir/test_syntax.vim
#v-

Okay, I have to fix a conflict:

#v+
1 39216 chrisbra@debian ~/code/git/vim-src (git)-[search_skip|rebase]- % vim 
src/testdir/test_syntax.vim
0 39217 chrisbra@debian ~/code/git/vim-src (git)-[search_skip|rebase]- % git 
add src/testdir/test_syntax.vim
0 39218 chrisbra@debian ~/code/git/vim-src (git)-[search_skip|rebase]- % git 
rebase --continue
Applying: Add skip expressions to search() function
#v-

And then I force push that branch back into my repository:

#v+
128 39220 chrisbra@debian ~/code/git/vim-src (git)-[search_skip]- % git push 
--force
#v-

The result looks like one single patch on top of Brams latest commits:
https://github.com/vim/vim/compare/master...chrisbra:search_skip


And if you already have created a pull request, that PR will be updated 
automatically to the single commit (and the previous one won't be seen).

I often check with git log -v and in case there are too many commits (or 
wrong ones from other branches), I usually fall back to git rebase -i
and deleting old ones or merging old ones or whatever is needed.


Best,
Christian
-- 
Wer viel mit Kindern lebt, wird finden, dass keine äußere 
Einwirkung auf sie ohne Gegenwirkung bleibt.
                -- Goethe, Maximen und Reflektionen, Nr. 412

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui