mirror of
https://github.com/nvbn/thefuck.git
synced 2025-11-18 15:56:00 +00:00
Add git_pull rule
This commit is contained in:
12
thefuck/rules/git_pull.py
Normal file
12
thefuck/rules/git_pull.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def match(command, settings):
|
||||
return ('git' in command.script
|
||||
and 'pull' in command.script
|
||||
and 'set-upstream' in command.stderr)
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
line = command.stderr.split('\n')[-3].strip()
|
||||
branch = line.split(' ')[-1]
|
||||
set_upstream = line.replace('<remote>', 'origin')\
|
||||
.replace('<branch>', branch)
|
||||
return u'{} && {}'.format(set_upstream, command.script)
|
||||
Reference in New Issue
Block a user