Re: git rebase -i --exec and changing directory
- From
Philip Oakley <philipoakley@iee.org>
- Date
- May 27, 2018, 12:28 UTC
- Message-ID
- <1EAAF778D73B4AA689ADB5AE2EE9D1DD@PhilipOakley>
- In-Reply-To
- <CAAUqJDvsRBJWZh5_A2e2x-CqgXi5gLSjo6-P2sYxsKz3qfidSw@mail.gmail.com>
You may need to give a bit more background of things that seem obvious to you. So where is the src directory you are cd'ing to relative to the directory/repository you are creating? What is [the name of] the directory you are currently in, etc. ?
Philip --
From: "Ondrej Mosnáček" <omosnacek@gmail.com> Bump? Has anyone had time to look at this?
2018-05-19 18:38 GMT+02:00 Ondrej Mosnáček <omosnacek@gmail.com>:
Show 39 quoted lines
> 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