Skip to content

Instantly share code, notes, and snippets.

@carlzulauf
Created May 11, 2022 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlzulauf/787968fca0b600878cc6b6c542cf229d to your computer and use it in GitHub Desktop.
Save carlzulauf/787968fca0b600878cc6b6c542cf229d to your computer and use it in GitHub Desktop.
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