Commit graph

156 commits

Author SHA1 Message Date
carlfriedrich fe5c4d9881 Reverse order on cherry pick
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.
2022-07-13 12:33:55 +02:00
carlfriedrich 1b7db0fb6e Preserve +/- information on cherry pick
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.
2022-07-12 16:42:18 +02:00
carlfriedrich 52d79009d1 Preserve commit order on cherry pick
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.
2022-07-12 16:35:54 +02:00
carlfriedrich 53d0ea2f38 Add FORGIT_CHERRY_PICK_FZF_OPTS
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.
2022-07-12 16:35:54 +02:00
sandroid f8b1fc8545
Changed alias for forgit::blame to gbl 2022-06-16 22:34:13 +02:00
sandroid 2d3dd568bb
gb: handle untracked files 2022-06-03 23:24:40 +02:00
sandroid 958e26add5
Added gb 2022-06-02 23:22:41 +02:00
Wenxuan 6385f85360
fix: gd show empty preview when path has spaces in zsh/bash (#204) 2022-05-28 17:04:23 -07:00
Wenxuan Zhang 544cf86bc4
docs: update comment 2022-05-20 17:44:51 +08:00
Chris Apple 75e9d12bac
Adding support for git branch delete method (#200)
* 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>
2022-05-11 09:41:21 -07:00
Wenxuan 0c4a3069ba
Merge pull request #199 from max-ae/fix/gd-spaces
fix: `forgit::diff` not working if repo path contains spaces
2022-05-10 10:02:04 +08:00
Max Eisner 25bb8aee24 fix: forgit::diff not working if repo path contains spaces 2022-05-10 10:00:57 +08:00
Pablo M. Bermudo Garay 4dd2ca2271 Fix gcb sort
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.
2022-04-06 15:48:49 +02:00
Pablo M. Bermudo Garay d32e3c282b Fix gcb verbose output
Delete the verbose option of git checkout, so just the branch names are
displayed.
2022-04-06 15:47:06 +02:00
sandroid 6a9c0e3f82
Refactored grc 2022-04-01 23:41:00 +02:00
sandroid e4874bf763
Replaced eval in grc 2022-04-01 22:01:37 +02:00
sandroid 1f90f50d26
Fixed: grc fails when commit is preceded by anything else than '* ' 2022-03-27 19:18:32 +02:00
carlfriedrich 76663aaf19 Make fzf '--preview' argument overridable in environment
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
2022-03-21 10:04:12 +01:00
Wenxuan c9185dda1a
Merge pull request #190 from sandr01d/grc
Implemented git revert commit
2022-03-21 08:43:56 +08:00
Wenxuan fca195a925
Merge pull request #189 from carlfriedrich/improve-forgit-diff
Improve forgit diff
2022-03-21 08:29:04 +08:00
sandroid 45cab4df9b
Added grc 2022-03-19 20:11:58 +01:00
carlfriedrich 2e5f06e789 gd: improve visualization for move/rename
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.
2022-03-11 19:18:13 +01:00
carlfriedrich 5093c18532 gd: support git move/rename
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.

Fixes wfxr/forgit#188
2022-03-11 18:37:30 +01:00
carlfriedrich 7d43115881 gd: support passing two revisions
Fixes wfxr/forgit#187
2022-03-10 11:35:54 +01:00
wallace 2aaa8fb6af Add missing support for FORGIT_GLO_FORMAT 2022-02-23 20:58:59 +02:00
sandroid ce19cc80ec
Added gct 2022-02-12 22:37:39 +01:00
Wenxuan Zhang 5d15fd3532
refactor: ci lint 2021-10-26 18:40:26 +08:00
Wenxuan eb6db722cd
Merge pull request #164 from wren/git-forgit-147 2021-10-22 10:41:00 +08:00
Wenxuan Zhang b86dc4b0c8
refactor: reduce git alias config steps 2021-10-22 10:38:17 +08:00
Wenxuan Zhang 05ab1c5864
Revert "fix: gcb can switch to an existed branch"
This reverts commit 8107352941.
2021-10-20 10:55:53 +08:00
Wenxuan bb55cf3f0a
Merge pull request #163 from crazy-matt/fix-checkout-branch-with-slashes 2021-10-20 10:49:11 +08:00
Jonathan Wren df36068105 add some comments for clarification 2021-10-17 23:36:16 -07:00
Jonathan Wren 896aaa44a4 add handling for standalone version of forgit (for use in git commands) 2021-10-17 22:56:32 -07:00
Wenxuan Zhang 8107352941
fix: gcb can switch to an existed branch 2021-09-23 10:17:23 +08:00
crazy-matt 6620e1347c
fix the checkout branch...
...when a local branch exists and contains slashes in its name.
2021-08-31 22:20:18 +01:00
Wenxuan Zhang 2db37aa4ec
feat: track the remote when possible #153 2021-06-02 13:00:51 +08:00
Wenxuan Zhang d5e0fd86e9
refactor: replace $* with $@
ref: 7c1d3b859e (commitcomment-50792390) (thanks @ytian81)
2021-05-14 10:18:48 +08:00
Wenxuan Zhang 7c1d3b859e
feat: add gco to checkout a commit 2021-04-07 17:23:00 +08:00
Chris Apple 81c35227cb
feat: implement gfu for fish (#149)
* 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
2021-04-07 08:37:21 +08:00
Ariel Davidov 69d6639220
feat: add fixup function (#146)
* 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>
2021-03-29 12:08:38 +08:00
rlanore 416ac0308f
fix: fix reset parameter in FORGIT_LOG_FORMAT default value (#145)
* Fix reset color int FORGIT_LOG_FORMAT default value

* Fix FORGIT_LOG_FORMAT default doc
2021-03-25 20:55:46 +08:00
rlanore 8538c052bf
feat: support custom git log format (#143)
* Add option to git log format tunnable

* Add FORGIT_LOG_FORMAT doc

* Fix shellchecks

* rename options misc

Co-authored-by: Wenxuan Zhang <wenxuangm@gmail.com>
2021-03-25 11:15:18 +08:00
Christopher Apple 74724a80cb Moved to new argument names version of arg parsing 2021-03-12 13:15:48 -08:00
Carlos de Paula 3faab44f66 Use argument to create new branch on gcb 2021-03-12 12:58:50 -08:00
Wenxuan Zhang 15383e6b4d
fix: fix copy without newline (#141)
Don't known why `tr -d '\n'` inner fzf options doesn't work.
Use `tr -d '[:space:]'` instead. It's OK for this scenario.
2021-03-10 10:01:20 +08:00
Wenxuan Zhang 29bc286228
fix: improve compatibility for vim (#138) 2021-03-08 10:39:19 +08:00
Chris Apple 7b18caa340
Fish checkout branch - updated internal function names to checkout::file and checkout::branch (#134)
* Initial commit, gcb working and function names fixed

* Fixing indentation
2021-02-18 11:51:54 +08:00
Yiannis 4cd46818a5
feat: add gcb to switch branches in a repo (#131 #26 #101)
I added `gcb` which is used to list all the branches and checkout into
one of your choice. I believe this is a useful functionality especially
when a repo has too many branches to rememmber and lookup.

The preview shows the log graph from the selected branch.
I have removed keybinding for copy commit hash on gcb alias

Signed-off-by: b10n1k <jbonatakis@gmail.com>
2021-02-07 18:21:51 +08:00
me 0e7399ce15 Reset color in git format after each line so next line does not get affected 2020-12-22 08:13:01 +03:00
Wenxuan Zhang 95526b3130
refactor: replace "-R" with "-r" for less pager 2020-11-11 19:36:14 +08:00