Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Duplicate declaration of grm in git.aliases.bash #2160

Open
bittner opened this issue Aug 30, 2022 · 6 comments · May be fixed by #2220
Open

[Bug]: Duplicate declaration of grm in git.aliases.bash #2160

bittner opened this issue Aug 30, 2022 · 6 comments · May be fixed by #2220

Comments

@bittner
Copy link
Contributor

bittner commented Aug 30, 2022

Expected behavior

After having activated the Git aliases, grm should do the same as git rm.

Current behavior

grm is an alias for git rebase. This is because the alias is redeclared after the first grm.

Possible solution

  1. Clarify what grm, grmi, grma are meant to be. Why are they (thought to be) intuitive to use?
  2. Decide whether to use different aliases for them (i.e. git rebase, e.g. based on grb) or for git rm.

Context

I attempted to remove a file with Git.

Steps to reproduce

  1. Install the latest version of Bash-it and activate git-aliases.
  2. Run grm on a file in a repository.

The file will not be removed, but an error message of git rebase will appear.

Bash-it version

dev (Current git SHA: d770030 on 2022-08-17T07:17:42+03:00)

List of enabled plugins, themes and aliases

general, git

Bash version

GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Operating system and version

Ubuntu 22.04.1 LTS jammy (on WSL 2)

bash-it doctor output

$ bash-it doctor
DEBUG: core: main: Loading libraries(except appearance)...
DEBUG: lib: colors: Loading library file...
DEBUG: lib: command_duration: Loading library file...
DEBUG: lib: helpers: Loading library file...
DEBUG: lib: history: Loading library file...
DEBUG: lib: log: Loading library file...
DEBUG: lib: preexec: Loading library file...
DEBUG: lib: preview: Loading library file...
DEBUG: lib: search: Loading library file...
DEBUG: lib: utilities: Loading library file...
DEBUG: core: reloader: Loading all enabled components...
DEBUG: aliases: general: Loading component...
DEBUG: aliases: general: Command 'gshuf' does not exist
DEBUG: aliases: general: Loaded.
DEBUG: aliases: git: Loading component...
DEBUG: aliases: git: Loaded.
DEBUG: plugin: base: Loading component...
DEBUG: plugin: base: Command 'markdown' does not exist
DEBUG: plugin: base: Command 'mkisofs' does not exist
DEBUG: plugin: base: Loaded.
DEBUG: completion: system: Loading component...
DEBUG: completion: system: Loaded.
DEBUG: completion: bash-it: Loading component...
DEBUG: completion: bash-it: Loaded.
DEBUG: completion: aliases: Loading component...
DEBUG: completion: aliases: Loaded.
DEBUG: core: main: Loading theme 'redline'.
DEBUG: core: main: Loading custom aliases, completion, plugins...
DEBUG: core: main: Loading general custom files...
DEBUG: custom: example: Loading custom file...
DEBUG: core: main: Command 'gloobus-preview' does not exist

Your ~/.bashrc

#!/usr/bin/env bash

# If not running interactively, don't do anything
case $- in
  *i*) ;;
    *) return;;
esac

# Path to the bash it configuration
export BASH_IT="/home/bittner/.bash_it"

# Lock and Load a custom theme file.
# Leave empty to disable theming.
# location /.bash_it/themes/
export BASH_IT_THEME='redline'

# Some themes can show whether `sudo` has a current token or not.
# Set `$THEME_CHECK_SUDO` to `true` to check every prompt:
#THEME_CHECK_SUDO='true'

# (Advanced): Change this to the name of your remote repo if you
# cloned bash-it with a remote other than origin such as `bash-it`.
# export BASH_IT_REMOTE='bash-it'

# (Advanced): Change this to the name of the main development branch if
# you renamed it or if it was changed for some reason
# export BASH_IT_DEVELOPMENT_BRANCH='master'

# Your place for hosting Git repos. I use this for private repos.
export GIT_HOSTING='https://git.example.com'

# Don't check mail when opening terminal.
unset MAILCHECK

# Change this to your console based IRC client of choice.
export IRC_CLIENT='irssi'

# Set this to the command you use for todo.txt-cli
export TODO="t"

# Set this to the location of your work or project folders
BASH_IT_PROJECT_PATHS="/mnt/c/Users/foobarbaz/projects"

# Set this to false to turn off version control status checking within the prompt for all themes
export SCM_CHECK=true
# Set to actual location of gitstatus directory if installed
#export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"
# per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must
#export GITSTATUS_NUM_THREADS=8

# Set Xterm/screen/Tmux title with only a short hostname.
# Uncomment this (or set SHORT_HOSTNAME to something else),
# Will otherwise fall back on $HOSTNAME.
#export SHORT_HOSTNAME=$(hostname -s)


# Set Xterm/screen/Tmux title with only a short username.
# Uncomment this (or set SHORT_USER to something else),
# Will otherwise fall back on $USER.
#export SHORT_USER=${USER:0:8}

# If your theme use command duration, uncomment this to
# enable display of last command duration.
#export BASH_IT_COMMAND_DURATION=true
# You can choose the minimum time in seconds before
# command duration is displayed.
#export COMMAND_DURATION_MIN_SECONDS=1

# Set Xterm/screen/Tmux title with shortened command and directory.
# Uncomment this to set.
#export SHORT_TERM_LINE=true

# Set vcprompt executable path for scm advance info in prompt (demula theme)
# https://github.com/djl/vcprompt
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt

# (Advanced): Uncomment this to make Bash-it reload itself automatically
# after enabling or disabling aliases, plugins, and completions.
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1

# Uncomment this to make Bash-it create alias reload.
# export BASH_IT_RELOAD_LEGACY=1

# Load Bash It
source "$BASH_IT"/bash_it.sh

Notes

No response

@davidpfarrell
Copy link
Member

Good catch ! Hope it didn't hurt too much when you discovered it ...

My take is to remove both the grm as "git rm" alias AND the gdel alias, which deletes a branch but you wouldn't know from the alias name ...

gr* seems solidly assigned to rebase and I prefer consistency over most other things ...

@bittner
Copy link
Contributor Author

bittner commented Aug 31, 2022

gr* seems solidly assigned to rebase and I prefer consistency over most other things ...

Actually, my take is, following your suggestion in #2159 (review), that grb should be assigned to rebase. Everything that is related to "rebase" may hence be prefixed by grb.

Following that logic we may keep grm as an alias for "remove" (which is easy for muscle memory, because it's very close to the original git rm) and, optionally, keep gdel as an alternative. – I've never used gdel before, TBH. Did you?

In my brain, for example, gr is wired to "remote" (e.g. grv = git remote -v).

@davidpfarrell
Copy link
Member

I had to sit with it for a bit, but I've come around to seeing value in having the git rebase aliases use the grb* prefix. This would result in changes to:

  • grm => grbm
  • grmi => grbmi
  • grma => grbma

There are a couple that have the r later in their names, ie:

  • alias gpr='git pull --rebase'
  • alias gprom='git fetch origin $(get_default_branch) && git rebase ...

I think its okay to leave these as-is (ie don't change to *rb*)

(side note re: gdel - I think this just needs to go away)

@bittner
Copy link
Contributor Author

bittner commented Aug 31, 2022

Then again, git pull is gl, and git push is gp, currently. That clashes with what you just proposed. 😟

@davidpfarrell
Copy link
Member

I don't see how they are related at all, as I was just seconding what you already proposed (git rebase aliases using prefix grb*), however ...

gl as an alias for git pull is an abomination that also needs to go away.
gp is too ambiguous and should also go away (and in fact I disable it in my local)

gpu* for git push aliases and gpl* for git pull aliases is almost okay, but still a bit tough ...

In general, I have a lot of issues with the git aliases, but my opinion is only a small drop in the bucket and, without a better place for discord on such things, I don't worry about trying to fix the whole file :)

@bittner
Copy link
Contributor Author

bittner commented Dec 4, 2022

I would tackle this as you suggested above, once we get #2159 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants