lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] valyuta/002 18ab8be 5/5: Oops


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] valyuta/002 18ab8be 5/5: Oops
Date: Sun, 20 Sep 2020 20:32:50 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 2020-09-20 19:36, Vadim Zeitlin wrote:
> On Sun, 20 Sep 2020 12:55:18 -0400 (EDT) Greg Chicares 
> <gchicares@sbcglobal.net> wrote:
> 
> GC> branch: valyuta/002
> GC> commit 18ab8be8c992ea32acbefd2ea2e144ee1458cbb6
> GC> Author: Gregory W. Chicares <gchicares@sbcglobal.net>
> GC> Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
> GC> 
> GC>     Oops
> GC>     
> GC>     (I'd normally `git rebase --interactive` for such a thing, but
> GC>     am not sure this branch can safely be rebased.)
> 
>  FWIW anything you haven't pushed yet is perfectly safe to rebase, as
> nobody else has seen the comments which are going to be rewritten yet. So
> in this case you could have done "git rebase -i origin/valyuta/002" without
> any problems as this wouldn't touch any commits up to and including the one
> previously pushed to Savannah, and hence the one I got.

Two points:

(1) I attempted it this way, without even thinking...

  /opt/lmi/src/lmi[0]$git rebase --interactive 
  There is no tracking information for the current branch.
  Please specify which branch you want to rebase against.
  See git-rebase(1) for details.
      git rebase '<branch>'
  If you wish to set tracking information for this branch you can do so with:
      git branch --set-upstream-to=<remote>/<branch> valyuta/002

...and the '--set-upstream-to' documentation seemed
abstruse enough to persuade me to sidestep the issue.

(2) More important: is it really safe? I wrote this in
'gwc/develop1.txt':

    # to transplant already-pushed commits to a new branch
  git branch odd/foo
  git reset --keep origin/master
    # ...and don't ever rebase that new branch

IIRC, I was just trying to distill a copy-and-paste-able
recipe from this discussion:

https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git

and was alarmed by:

| WARNING: With Git version 2.0 and later, if you later git rebase the new
| branch upon the original (master) branch, you may need an explicit
| --no-fork-point option during the rebase to avoid losing the carried-over
| commits. Having branch.autosetuprebase always set makes this more likely.

| Most previous answers are dangerously wrong!
|
| Do NOT do this:
|
| git branch -t newbranch
| git reset --hard HEAD~3
| git checkout newbranch
|
| As the next time you run git rebase (or git pull --rebase) those 3
| commits would be silently discarded from newbranch!

At my level of git comprehension, this might as well say
  "Never say 'presto!' after 'abracadabra!' Or else!!!"
and who am I to argue? I'm just the sorcerer's apprentice,
and I don't want to destroy the fabric of the universe.

IIRC, valyuta/002 inherited this curse from some ancestor
that was created with such a technique...AIUI, but I
really understand nothing.

As one of our great philosophers said: "when you believe
in things you don't understand, you suffer...".

So should I just
  git branch --set-upstream-to= valyuta/002
or, what seems less arcane to me, when I next push, do:
  git push --set-upstream origin valyuta/002
?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]