Skip to content

Instantly share code, notes, and snippets.

Created May 11, 2022 21:38
What would you like to do?
git pullf
#!/usr/bin/env ruby
# git pullf
# ---------
# Force pull without needing to be verbose
current = `git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)`
remote, remote_branch = current.strip.split("/", 2)
branch = `git branch | grep \\* | cut -d ' ' -f2`
command = "git pull --force #{remote} #{remote_branch}:#{branch}"
puts command
exec command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment