The git rebase command needs to be passed the parent commit of the one
you want to edit. When selecting a commit interactively via fzf, it
makes sense to automatically pass the parent commit of the selected one.
Within fzf it's otherwise quite hard to find the parent commit by hand
if you have found your commit via an fzf search string.
This reduces code duplication. We cannot implement this as a function,
because fish and zsh do not support exporting functions, but we need it
in subshells (see https://github.com/fish-shell/fish-shell/issues/6961).
Implement it as a variable in all shells instead.
The preview on cherry pick was accidentally broken since we included the
+/- information in the commit list. Fix this by using the correct string
index.
Git log displays the newest commits on top of the list, while git cherry
pick displays the newest commits at the bottom. Reverse the order of
git cherry pick so that it has the same order like git log.
The output of 'git cherry' which is used to build the fzf input list for
forgit::cherry::pick usually prefixes every line with a '-' for commits
that have an equivalent in the target branch, and a '+' for commits that
do not.
Previously forgit removed this information from the list. However, for
the actual cherry-picking process this information is relevant, so we
should keep it.
When using a fzf find string which maches multiple lines, the commits
could appear in a wrong order. Add "--tiebreak=index" to ensure that the
correct commit order is preserved.
The gcp (git cherry pick) command was the only command which did not
have a variable to set command-specific fzf options. Add the according
variable to source code and documentation.
* Adding support for git branch delete method in fish
* Add new doc to README
* Added options like gcb
* refactor: remove `--all` flag from gbd
* feat: sync forgit::branch::delete to bash and zsh
Co-authored-by: Wenxuan Zhang <wenxuangm@gmail.com>
Use LC_ALL=C to avoid potential ordering issues related to the user's
locale configuration. Additionally, add the --stable option to ensure
that just the range defined with --key is used.
Arguments to fzf are passed via the FZF_DEFAULT_OPTS environment
variable, which can be overridden by a dedicated FORGIT_<cmd>_FZF_OPTS
variable for each command separately. The '--preview' argument, however,
was excluded from this mechanism and hard-coded to the fzf call, so that
there was no chance overriding it.
This patch moves the passing of this argument to the FZF_DEFAULT_OPTS
variable for all commands, so that it can be overridden as well.
Fixes#185
Show an arrow instead of just blank spaces when a file has been moved
or renamed:
[R100] foo.txt -> bar.txt
The arrow is added as a replacement for the second tabspace of the "git
diff --name-status" command. For the preview command it is replaced by a
single space again.
For "git diff" to display a move/rename action correctly, it has to be
passed both the old and the new file name. Change the gd preview command
accordingly: instead of constructing a path out of the repo directory
and the file name (which would not work with multiple file names), cd to
the repo directory and use the file names as direct arguments to "git
diff" instead.
Change the regex used to parse the "git diff --name-status" output so
that it supports the "Rxxx" syntax for moved/renamed files.
Use tabs instead of hardcoded number of spaces along with "expand" to
have file names horizontally aligned.
Fixeswfxr/forgit#188
* first attempt at fish gfu
* small tweak for test
* First commit
* Second commit
* fixup! First commit
* fixup! First commit
* removing test files
* Fixing typo after testing
* fixup! First commit
* Fix bug in original implementation
* fixup! First commit
* removing test file
* Commit 1 test
* Commit 2 test
* Finished fish implementation
* Add fixup function
Signed-off-by: Ariel Davidov <arik.davidov@gmail.com>
* refactor: more accurate editor
* refactor: support to fixup the first commit
Co-authored-by: Wenxuan Zhang <wenxuangm@gmail.com>