threads / discuss / 16192

Workflow for sharing changes on top of often-rebased work

Subject: Workflow for sharing changes on top of often-rebased work

## tl;dr

One message between Nov 6, 2008 and Nov 6, 2008.

replies: 0people: 1as markdown or json

Mike Mazur· Nov 6, 2008, 01:57 UTC · lore
Hi,

I have a set of changes on top of an SVN tree I'm tracking with git. The SVN changes regularly, and I like to keep my changes up-to-date as well. The branch containing my changes lives on my workstation, but also in a remote repo so I can also work from my laptop, and others can look at my work.

Here's my current workflow:
First, I clone the SVN repo on my workstation:

$ git svn clone ssh://remote/svn repo $ cd repo

I then created a bare repo on a server (git://remote/repo) which is how I share my changes between my workstation, laptop, and others. In my repo, I add this remote location as origin. Occasionally I will rebase my master against SVN and push this to the server:

$ git remote add origin git://remote/repo $ git remote update $ git checkout master $ git svn rebase $ git push origin master:master

Now, to do my work, I made a branch based on master in which my changes will live:

$ git branch my_work master $ git checkout my_work

Then I hack away and have a bunch of commits. I publish this branch on my server:

$ git checkout my_work $ git push origin my_work # create branch my_work in git://remote/repo

Eventually, I'd like to rebase this work on top of the latest SVN revision. First I update my master branch against SVN:

$ git checkout master $ git svn rebase $ git push origin master:master

And then I rebase my work on top of that:

$ git checkout my_work $ git rebase master # resolve conflicts $ git rebase --continue

At this point, I'd like to push my_work to the server:
$ git checkout my_work
$ git push origin my_work:my_work
To git://remote/repo
 ! [rejected]        my_work -> my_work (non-fast forward)
error: failed to push some refs to 'git://remote/repo'
What's the proper way to do this?

I've read a few threads in the archives and came across an email by Junio[1] that shows how using `git push --force` and setting "receive.denynonfastforwards = false" on the remote repo will allow me to push these changes. Is this the best way forward? If it is, how do I (or others) update the my_work branch after a non-fast forward push to the remote repo?

Your insights greatly appreciated! Mike

[1] http://marc.info/?l=git&m=119540948816950&w=2

← back to recent threads