Op 21-3-2012 15:51, Jean-Marc Lasgouttes schreef:
Le 12/03/2012 19:56, Vincent van Ravesteijn a écrit :
If you want a tree for both 2.0.x and 2.1.0svn, you can do the
following:
Assume you have a git clone in <home>/lyx, you can clone this with
git clone -s -b 2.0.x <home>/lyx <home>/lyx20x
This will clone your repo, but it will reuse the objects. This means
that the second repo is much smaller than the first one.
OK, I have done that, and now I am trying to backport a patch to
branch. I don't want to be a git jedi just now, so I applied the patch
I had to my 2.0.x branch checkout, did 'git add' for the modified files,
a commit for good measure.
There is also a 2.0.x branch in your first clone, so you can just
cherry-pick the commit to master directly onto this 2.0.x branch, and
push from there.
I am happy, I can do 'git format-patch' and see a nice formated patch
like the grown ups do.
Alas, now comes the time to put my patch to the git.lyx.org server. I
do a 'git push' in my 2.0.x branch to see what happens. Things happen
(cryptic messages I do not have anymore), but nothing in the lyx-cvs
list.
OK, I think, the stuff has been committed from my shared 2.0.x
directory to the original lyx checkout on my computer, so I have to
push there too.
Yes.
You can also push directly from your 2.0.x clone by adding the remote to
this clone:
$ git remote add lyx g...@git.lyx.org:lyx
Now you can push your branch to "lyx":
$ git push lyx 2.0.x
Use
$ git remote -v
to see the remotes that are set up for a clone. For your 2.0.x clone
you'll indeed see that the origin the your original clone.
But when I push in lyx/ (which is the full checkout), I get:
fantomas: git push
To g...@git.lyx.org:lyx
! [rejected] 2.0.x -> 2.0.x (non-fast-forward)
error: failed to push some refs to 'g...@git.lyx.org:lyx'
To prevent you from losing history, non-fast-forward updates were
rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
Where do I go from there? There has to be a simple way to commit a
patch to branch (please tell me there is!). I understand that plenty
of probably exciting and complicated ways of working on a branch have
been given, but I would like to start with trivial stuff like making a
commit of a bite-size patch on a branch.
The hint in the error message says that you have to merge the remote
changes before you push. This is the same as that svn would tell you
that your repo is not up to date.
Most probably the following will solve this:
$ git pull --rebase
(though I recommend to do 'git fetch', 'git merge --ff-only', and only
rebase your feature branch on top of master when you really want to push
it).
JMarc
Vincent