git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: greened@obbligato.org (David A. Greene)
To: git@vger.kernel.org
Subject: rebase -X subtree
Date: Mon, 30 Nov 2015 20:22:46 -0600	[thread overview]
Message-ID: <87lh9e9abt.fsf@waller.obbligato.org> (raw)

Hi,

I had a particular notion of what rebase -X subtree would do but I am
apparently mistaken.  What should be the result of the script below?  I
expected commits to be replayed on top of master with their trees
adjusted to move files into a "files" directory.  In the first case, the
rebase seems to have done nothing.  In the second case I get an error:

First, rewinding head to replay your work on top of it...
fatal: Could not parse object '6c0826e4cf4b1f44ebafbd4084c1f0066a59d112^'
Unknown exit code (128) from command: git-merge-recursive 6c0826e4cf4b1f44ebafbd4084c1f0066a
59d112^ -- HEAD 6c0826e4cf4b1f44ebafbd4084c1f0066a59d112                                   

If "files" exists and I use rebase -X subtree it replays the commits,
moving trees out from under "files," as I would expect.  Is it not
possible to use git rebase to move trees under a new subdirectory?

I know that I can use filter-branch to accomplish what I want, I'm just
curious whether git rebase is expected to behave as I thought.  At the
very least, it seems a better error message in the orphan branch case
would be helpful.

Thanks for you help!

                      -David

#!/bin/bash

function addfile {
    name=$1
    echo ${name} > ${name}
    git add ${name}
    git commit -m "Add ${name}"
}

mkdir rebasetest1
cd rebasetest1
git init

addfile README

git checkout -b work

addfile file1

git rebase -X subtree=files --onto master master

cd ..

mkdir rebasetest2
cd rebasetest2
git init

addfile README

git checkout --orphan work

addfile file1

git rebase -X subtree=files --onto master --root

                 reply	other threads:[~2015-12-01  2:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lh9e9abt.fsf@waller.obbligato.org \
    --to=greened@obbligato.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).