nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
85.12k stars 3.43k forks source link

Pushing new branches no longer works #1219

Closed Airblader closed 2 years ago

Airblader commented 3 years ago

The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

The Fuck 3.31 using Python 3.9.6 and Bash 5.1.8(1)-release

Your system (Debian 7, ArchLinux, Windows, etc.):

Manjaro

How to reproduce the bug:

I always "git push + fuck" to push new branches. However, as of recently this no longer works because fuck tries to execute the wrong command:

$ git checkout -b fuckme
$ git push
fatal: The current branch fuckme has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin fuckme

$ fuck
git push --no-verify [enter/↑/↓/ctrl+c]

fatal: The current branch fuckme has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin fuckme

The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

✗ fuck
DEBUG: Run with settings: {'alter_history': True,
 'debug': True,
 'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
 'exclude_rules': [],
 'excluded_search_path_prefixes': [],
 'history_limit': None,
 'instant_mode': False,
 'no_colors': False,
 'num_close_matches': 3,
 'priority': {},
 'repeat': False,
 'require_confirmation': True,
 'rules': [<const: All rules enabled>],
 'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
 'user_dir': PosixPath('/home/ingo/.config/thefuck'),
 'wait_command': 3,
 'wait_slow_command': 15}
DEBUG: Received output: 14:23:37.834998 git.c:743               trace: exec: git-p
14:23:37.835020 run-command.c:667       trace: run_command: git-p
14:23:37.835082 git.c:396               trace: alias expansion: p => push
14:23:37.835085 git.c:804               trace: exec: git push
14:23:37.835087 run-command.c:667       trace: run_command: git push
14:23:37.835769 git.c:455               trace: built-in: git push
fatal: The current branch test has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin test

DEBUG: Call: git p; with env: {'SHELL': '/bin/bash', 'WINDOWID': '88080387', 'TF_SHELL': 'bash', 'COLORTERM': 'truecolor', 'HISTCONTROL': 'ignoreboth', 'HISTSIZE': '10000', 'I3SOCK': '/run/user/1000/i3/ipc-socket.1366', 'LC_ADDRESS': 'de_DE.UTF-8', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'GRADLE_HOME': '/usr/share/java/gradle', 'LC_MONETARY': 'de_DE.UTF-8', 'SSH_AGENT_PID': '1333', 'CLOUDSDK_PYTHON_ARGS': '-S', 'EDITOR': '/usr/bin/vim', 'GTK_MODULES': 'canberra-gtk-module', 'XDG_SEAT': 'seat0', 'PWD': '/home/ingo/repos/blog-imap', 'LOGNAME': 'ingo', 'XDG_SESSION_TYPE': 'tty', 'SYSTEMD_EXEC_PID': '868', 'XAUTHORITY': '/home/ingo/.Xauthority', 'WINDOWPATH': '1', 'MOTD_SHOWN': 'pam', 'HOME': '/home/ingo', 'LC_PAPER': 'de_DE.UTF-8', 'LANG': 'C', 'STARSHIP_SHELL': 'bash', 'VTE_VERSION': '5602', 'CLOUDSDK_ROOT_DIR': '/opt/google-cloud-sdk', 'INVOCATION_ID': '4132cdddade74087a9ed3b23c44181bf', 'FIGNORE': '.o:.trs:~', 'STARSHIP_SESSION_KEY': '2379282121040246', 'TF_ALIAS': 'fuck', 'CLOUDSDK_PYTHON': 'python', 'XDG_SESSION_CLASS': 'user', 'TERM': 'xterm-termite', 'TF_HISTORY': '\t thefuck --version\n\t vim .bash.d/fuck \n\t cd repos/blog-imap/\n\t git p\n\t fuck\n\t fuck --version\n\t rclear \n\t export THEFUCK_DEBUG=true\n\t rclear \n\t git p', 'npm_config_prefix': '/home/ingo/.npm-global', 'GOOGLE_CLOUD_SDK_HOME': '/opt/google-cloud-sdk', 'USER': 'ingo', 'PYTHONIOENCODING': 'utf-8', 'TF_SHELL_ALIASES': 'alias beerme=\'yay --answerclean None --answerdiff None --answeredit None -Syyu ; pkill -RTMIN+3 i3blocks\'\nalias bell=\'echo -e \'\\\'\'\\a\'\\\'\'\'\nalias cdf=\'cd /home/ingo/repos/flink\'\nalias cds=\'cd /home/ingo/repos/vvp-services\'\nalias cdui=\'cd /home/ingo/repos/vvp-ui\'\nalias cp=\'cp -i\'\nalias df=\'df -h\'\nalias fixit=\'sudo rm -f /var/lib/pacman/db.lck && sudo pacman-mirrors -g && sudo pacman -Syyuu  && \nsudo pacman -Suu\'\nalias free=\'free -m\'\nalias g=\'./gradlew\'\nalias ga=\'./gradlew assemble\'\nalias gca=\'./gradlew clean assemble\'\nalias gcacc=\'gca && ./gradlew :vvp-sql-connectors:copyConnectors\'\nalias gp=\'./gradlew :vvp-core:generateProto\'\nalias grep=\'grep --color=tty -d skip\'\nalias gsp=\'./gradlew spotlessApply\'\nalias k=\'kubectl\'\nalias ls=\'ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F\'\nalias mcp=\'mvn clean package -DskipTests -Dfast -Pskip-webui-build\'\nalias mmi=\'make && sudo make install\'\nalias rclear=\'tput reset && source ~/.bashrc\'\nalias sshme=\'ssh-add ~/.ssh/*.sshkey\'\nalias ydl=\'youtube-dl -o "%(title)s.%(ext)s" -x --audio-format "mp3" --audio-quality 0\'', 'DISPLAY': ':0', 'SHLVL': '3', 'LC_MESSAGES': 'en_US.UTF-8', 'LC_MEASUREMENT': 'de_DE.UTF-8', 'XDG_VTNR': '1', 'XDG_SESSION_ID': '1', 'XDG_RUNTIME_DIR': '/run/user/1000', 'JAVA_FONTS': '/usr/share/fonts/TTF', 'LC_TIME': 'de_DE.UTF-8', 'JOURNAL_STREAM': '8:18712', 'XDG_DATA_DIRS': '/usr/local/share:/usr/share:/var/lib/snapd/desktop', 'BROWSER': '', 'PATH': '/home/ingo/.npm-global/bin:/home/ingo/.npm-global/bin:/home/ingo/.npm-global/bin:/home/ingo/.local/bin:/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin', 'HISTFILESIZE': '10000', 'THEFUCK_DEBUG': 'true', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'MAIL': '/var/spool/mail/ingo', 'OLDPWD': '/home/ingo', '_': '/usr/bin/thefuck', 'LC_ALL': 'C', 'GIT_TRACE': '1'}; is slow: False took: 0:00:00.005015
DEBUG: Importing rule: adb_unknown_command; took: 0:00:00.000201
DEBUG: Importing rule: ag_literal; took: 0:00:00.000265
DEBUG: Importing rule: apt_get; took: 0:00:00.000519
DEBUG: Importing rule: apt_get_search; took: 0:00:00.000132
DEBUG: Importing rule: apt_invalid_operation; took: 0:00:00.000334
DEBUG: Importing rule: apt_list_upgradable; took: 0:00:00.000143
DEBUG: Importing rule: apt_upgrade; took: 0:00:00.000217
DEBUG: Importing rule: aws_cli; took: 0:00:00.000132
DEBUG: Importing rule: az_cli; took: 0:00:00.000127
DEBUG: Importing rule: brew_cask_dependency; took: 0:00:00.000366
DEBUG: Importing rule: brew_install; took: 0:00:00.000098
DEBUG: Importing rule: brew_link; took: 0:00:00.000131
DEBUG: Importing rule: brew_reinstall; took: 0:00:00.000331
DEBUG: Importing rule: brew_uninstall; took: 0:00:00.000130
DEBUG: Importing rule: brew_unknown_command; took: 0:00:00.000106
DEBUG: Importing rule: brew_update_formula; took: 0:00:00.000159
DEBUG: Importing rule: cargo; took: 0:00:00.000080
DEBUG: Importing rule: cargo_no_command; took: 0:00:00.000121
DEBUG: Importing rule: cat_dir; took: 0:00:00.000121
DEBUG: Importing rule: cd_correction; took: 0:00:00.000512
DEBUG: Importing rule: cd_cs; took: 0:00:00.000145
DEBUG: Importing rule: cd_mkdir; took: 0:00:00.000142
DEBUG: Importing rule: cd_parent; took: 0:00:00.000180
DEBUG: Importing rule: chmod_x; took: 0:00:00.000083
DEBUG: Importing rule: choco_install; took: 0:00:00.000221
DEBUG: Importing rule: composer_not_command; took: 0:00:00.000130
DEBUG: Importing rule: conda_mistype; took: 0:00:00.000122
DEBUG: Importing rule: cp_create_destination; took: 0:00:00.000123
DEBUG: Importing rule: cp_omitting_directory; took: 0:00:00.000181
DEBUG: Importing rule: cpp11; took: 0:00:00.000119
DEBUG: Importing rule: dirty_untar; took: 0:00:00.000783
DEBUG: Importing rule: dirty_unzip; took: 0:00:00.000928
DEBUG: Importing rule: django_south_ghost; took: 0:00:00.000093
DEBUG: Importing rule: django_south_merge; took: 0:00:00.000150
DEBUG: Importing rule: dnf_no_such_command; took: 0:00:00.000401
DEBUG: Importing rule: docker_image_being_used_by_container; took: 0:00:00.000134
DEBUG: Importing rule: docker_login; took: 0:00:00.000123
DEBUG: Importing rule: docker_not_command; took: 0:00:00.000219
DEBUG: Importing rule: dry; took: 0:00:00.000086
DEBUG: Importing rule: fab_command_not_found; took: 0:00:00.000144
DEBUG: Importing rule: fix_alt_space; took: 0:00:00.000118
DEBUG: Importing rule: fix_file; took: 0:00:00.001263
DEBUG: Importing rule: gem_unknown_command; took: 0:00:00.000290
DEBUG: Importing rule: git_add; took: 0:00:00.000259
DEBUG: Importing rule: git_add_force; took: 0:00:00.000120
DEBUG: Importing rule: git_bisect_usage; took: 0:00:00.000119
DEBUG: Importing rule: git_branch_delete; took: 0:00:00.000112
DEBUG: Importing rule: git_branch_delete_checked_out; took: 0:00:00.000116
DEBUG: Importing rule: git_branch_exists; took: 0:00:00.000169
DEBUG: Importing rule: git_branch_list; took: 0:00:00.000112
DEBUG: Importing rule: git_checkout; took: 0:00:00.000125
DEBUG: Importing rule: git_clone_git_clone; took: 0:00:00.000126
DEBUG: Importing rule: git_commit_amend; took: 0:00:00.000110
DEBUG: Importing rule: git_commit_reset; took: 0:00:00.000110
DEBUG: Importing rule: git_diff_no_index; took: 0:00:00.000113
DEBUG: Importing rule: git_diff_staged; took: 0:00:00.000110
DEBUG: Importing rule: git_fix_stash; took: 0:00:00.000116
DEBUG: Importing rule: git_flag_after_filename; took: 0:00:00.000145
DEBUG: Importing rule: git_help_aliased; took: 0:00:00.000113
DEBUG: Importing rule: git_hook_bypass; took: 0:00:00.000117
DEBUG: Importing rule: git_lfs_mistype; took: 0:00:00.000114
DEBUG: Importing rule: git_merge; took: 0:00:00.000113
DEBUG: Importing rule: git_merge_unrelated; took: 0:00:00.000116
DEBUG: Importing rule: git_not_command; took: 0:00:00.000118
DEBUG: Importing rule: git_pull; took: 0:00:00.000184
DEBUG: Importing rule: git_pull_clone; took: 0:00:00.000114
DEBUG: Importing rule: git_pull_uncommitted_changes; took: 0:00:00.000116
DEBUG: Importing rule: git_push; took: 0:00:00.000120
DEBUG: Importing rule: git_push_different_branch_names; took: 0:00:00.000110
DEBUG: Importing rule: git_push_force; took: 0:00:00.000113
DEBUG: Importing rule: git_push_pull; took: 0:00:00.000118
DEBUG: Importing rule: git_push_without_commits; took: 0:00:00.000184
DEBUG: Importing rule: git_rebase_merge_dir; took: 0:00:00.000129
DEBUG: Importing rule: git_rebase_no_changes; took: 0:00:00.000137
DEBUG: Importing rule: git_remote_delete; took: 0:00:00.000114
DEBUG: Importing rule: git_remote_seturl_add; took: 0:00:00.000149
DEBUG: Importing rule: git_rm_local_modifications; took: 0:00:00.000172
DEBUG: Importing rule: git_rm_recursive; took: 0:00:00.000123
DEBUG: Importing rule: git_rm_staged; took: 0:00:00.000118
DEBUG: Importing rule: git_stash; took: 0:00:00.000120
DEBUG: Importing rule: git_stash_pop; took: 0:00:00.000113
DEBUG: Importing rule: git_tag_force; took: 0:00:00.000118
DEBUG: Importing rule: git_two_dashes; took: 0:00:00.000114
DEBUG: Importing rule: go_run; took: 0:00:00.000125
DEBUG: Importing rule: go_unknown_command; took: 0:00:00.000189
DEBUG: Importing rule: gradle_no_task; took: 0:00:00.000312
DEBUG: Importing rule: gradle_wrapper; took: 0:00:00.000133
DEBUG: Importing rule: grep_arguments_order; took: 0:00:00.000130
DEBUG: Importing rule: grep_recursive; took: 0:00:00.000153
DEBUG: Importing rule: grunt_task_not_found; took: 0:00:00.000230
DEBUG: Importing rule: gulp_not_task; took: 0:00:00.000156
DEBUG: Importing rule: has_exists_script; took: 0:00:00.000133
DEBUG: Importing rule: heroku_multiple_apps; took: 0:00:00.000125
DEBUG: Importing rule: heroku_not_command; took: 0:00:00.000122
DEBUG: Importing rule: history; took: 0:00:00.000082
DEBUG: Importing rule: hostscli; took: 0:00:00.000144
DEBUG: Importing rule: ifconfig_device_not_found; took: 0:00:00.000142
DEBUG: Importing rule: java; took: 0:00:00.000119
DEBUG: Importing rule: javac; took: 0:00:00.000121
DEBUG: Importing rule: lein_not_task; took: 0:00:00.000140
DEBUG: Importing rule: ln_no_hard_link; took: 0:00:00.000117
DEBUG: Importing rule: ln_s_order; took: 0:00:00.000119
DEBUG: Importing rule: long_form_help; took: 0:00:00.000085
DEBUG: Importing rule: ls_all; took: 0:00:00.000125
DEBUG: Importing rule: ls_lah; took: 0:00:00.000154
DEBUG: Importing rule: man; took: 0:00:00.000188
DEBUG: Importing rule: man_no_space; took: 0:00:00.000081
DEBUG: Importing rule: mercurial; took: 0:00:00.000126
DEBUG: Importing rule: missing_space_before_subcommand; took: 0:00:00.000090
DEBUG: Importing rule: mkdir_p; took: 0:00:00.000116
DEBUG: Importing rule: mvn_no_command; took: 0:00:00.000124
DEBUG: Importing rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000124
DEBUG: Importing rule: nixos_cmd_not_found; took: 0:00:00.000320
DEBUG: Importing rule: no_command; took: 0:00:00.000138
DEBUG: Importing rule: no_such_file; took: 0:00:00.000087
DEBUG: Importing rule: npm_missing_script; took: 0:00:00.000268
DEBUG: Importing rule: npm_run_script; took: 0:00:00.000129
DEBUG: Importing rule: npm_wrong_command; took: 0:00:00.000154
DEBUG: Importing rule: omnienv_no_such_command; took: 0:00:00.000316
DEBUG: Importing rule: open; took: 0:00:00.000153
DEBUG: Importing rule: pacman; took: 0:00:00.000321
DEBUG: Importing rule: pacman_invalid_option; took: 0:00:00.000151
DEBUG: Importing rule: pacman_not_found; took: 0:00:00.000214
DEBUG: Importing rule: path_from_history; took: 0:00:00.000114
DEBUG: Importing rule: php_s; took: 0:00:00.000134
DEBUG: Importing rule: pip_install; took: 0:00:00.000133
DEBUG: Importing rule: pip_unknown_command; took: 0:00:00.000136
DEBUG: Importing rule: port_already_in_use; took: 0:00:00.000150
DEBUG: Importing rule: prove_recursively; took: 0:00:00.000135
DEBUG: Importing rule: python_command; took: 0:00:00.000117
DEBUG: Importing rule: python_execute; took: 0:00:00.000121
DEBUG: Importing rule: python_module_error; took: 0:00:00.000084
DEBUG: Importing rule: quotation_marks; took: 0:00:00.000074
DEBUG: Importing rule: react_native_command_unrecognized; took: 0:00:00.000149
DEBUG: Importing rule: remove_shell_prompt_literal; took: 0:00:00.000082
DEBUG: Importing rule: remove_trailing_cedilla; took: 0:00:00.000082
DEBUG: Importing rule: rm_dir; took: 0:00:00.000115
DEBUG: Importing rule: rm_root; took: 0:00:00.000116
DEBUG: Importing rule: scm_correction; took: 0:00:00.000141
DEBUG: Importing rule: sed_unterminated_s; took: 0:00:00.000199
DEBUG: Importing rule: sl_ls; took: 0:00:00.000084
DEBUG: Importing rule: ssh_known_hosts; took: 0:00:00.000129
DEBUG: Importing rule: sudo; took: 0:00:00.000086
DEBUG: Importing rule: sudo_command_from_user_path; took: 0:00:00.000127
DEBUG: Importing rule: switch_lang; took: 0:00:00.000137
DEBUG: Importing rule: systemctl; took: 0:00:00.000147
DEBUG: Importing rule: terraform_init; took: 0:00:00.000127
DEBUG: Importing rule: test.py; took: 0:00:00.000080
DEBUG: Importing rule: tmux; took: 0:00:00.000122
DEBUG: Importing rule: touch; took: 0:00:00.000125
DEBUG: Importing rule: tsuru_login; took: 0:00:00.000122
DEBUG: Importing rule: tsuru_not_command; took: 0:00:00.000121
DEBUG: Importing rule: unknown_command; took: 0:00:00.000079
DEBUG: Importing rule: unsudo; took: 0:00:00.000079
DEBUG: Importing rule: vagrant_up; took: 0:00:00.000125
DEBUG: Importing rule: whois; took: 0:00:00.000232
DEBUG: Importing rule: workon_doesnt_exists; took: 0:00:00.000154
DEBUG: Importing rule: yarn_alias; took: 0:00:00.000165
DEBUG: Importing rule: yarn_command_not_found; took: 0:00:00.000291
DEBUG: Importing rule: yarn_command_replaced; took: 0:00:00.000199
DEBUG: Importing rule: yarn_help; took: 0:00:00.000132
DEBUG: Importing rule: yum_invalid_operation; took: 0:00:00.000314
DEBUG: Trying rule: path_from_history; took: 0:00:00.000358
DEBUG: Trying rule: cd_cs; took: 0:00:00.000039
DEBUG: Trying rule: dry; took: 0:00:00.000002
DEBUG: Trying rule: git_hook_bypass; took: 0:00:00.000174
git push --no-verify [enter/↑/↓/ctrl+c]
scorphus commented 3 years ago

This is a dupe of #1207 and is already fixed in current master. A new release is being prepared and will be out soon.

Until then, here's a workaround. Changing the priority of the git_hook_bypass will bring back the previous, desired behaviour. Just export THEFUCK_PRIORITY as the following for all shell sessions (.bashrc, .profile, .zshrc or config.fish depending on your shell).

export THEFUCK_PRIORITY="git_hook_bypass=1100"

Please refer to the Settings session of the documention if you'd like to change more than one priority.

Sorry for this inconvenience. I'll leave this open for the time being.

Airblader commented 3 years ago

Ah, I see. I had only looked for open issues. Thanks for the swift reply and the great tool!

scorphus commented 2 years ago

3.32 is finally out! :tada: