Skip to content

Instantly share code, notes, and snippets.

@Tharwat96
Last active September 3, 2020 10:27
Show Gist options
  • Save Tharwat96/ff1b8d25c9360430a52ac58e107426f3 to your computer and use it in GitHub Desktop.
Save Tharwat96/ff1b8d25c9360430a52ac58e107426f3 to your computer and use it in GitHub Desktop.
git scripts
# sort all branches in repository by date updated
git for-each-ref --sort=committerdate refs/heads/ --format="%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))" --no-merged=origin/HEAD refs/remotes/origin
#!/bin/bash
# this script allows for pulling all branches in a remote repository
for i in $(git for-each-ref --format="%(refname:short)" --no-merged=origin/HEAD refs/remotes/origin); do \
git switch --track $i; \
git pull --ff-only; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment