Created
May 11, 2022 21:38
-
-
Save carlzulauf/787968fca0b600878cc6b6c542cf229d to your computer and use it in GitHub Desktop.
git pullf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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