From: "Ondrej Mosnáček" <omosnacek@gmail.com>
To: git@vger.kernel.org
Subject: git rebase -i --exec and changing directory
Date: Sat, 19 May 2018 18:38:46 +0200 [thread overview]
Message-ID: <CAAUqJDu_3DTyd1cFKaNRKOzo3AHosfxP1jjWpa=HGtyAyitTeA@mail.gmail.com> (raw)
Hello,
I am trying to run a script to edit multiple commits using 'git rebase
-i --exec ...' and I ran into a strange behavior when I run 'cd'
inside the --exec command and subsequently run a git command. For
example, if the command is 'cd src && git status', then git status
reports as if all files in the repository are deleted.
Example command sequence to reproduce the problem:
# Setup:
touch a
mkdir dir
touch dir/x
git init .
git add --all
git commit -m commit1
git tag base
touch b
git add --all
git commit -m commit2
# Here we go:
git rebase -i --exec 'cd dir && git status' base
# Spawning a sub-shell doesn't help:
git rebase -i --exec '(cd dir && git status)' base
Is this expected behavior or did I found a bug? Is there any
workaround, other than cd'ing to the toplevel directory every time I
want to run a git command when I am inside a subdirectory?
$ git --version
git version 2.17.0
Thanks,
Ondrej Mosnacek
next reply other threads:[~2018-05-19 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-19 16:38 Ondrej Mosnáček [this message]
2018-05-27 10:59 ` git rebase -i --exec and changing directory Ondrej Mosnáček
2018-05-27 12:28 ` Philip Oakley
2018-05-27 12:53 ` Ondrej Mosnáček
2018-05-27 16:07 ` Phillip Wood
2018-05-27 17:25 ` Philip Oakley
2018-05-27 17:25 ` Philip Oakley
2018-05-28 2:45 ` Junio C Hamano
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='CAAUqJDu_3DTyd1cFKaNRKOzo3AHosfxP1jjWpa=HGtyAyitTeA@mail.gmail.com' \
--to=omosnacek@gmail.com \
--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).