Bash - git helper functions

# .bash_profile # git function git_fetch_tags() { echo -e "\nUpdating local tags with remote tags...\n" git fetch origin 'refs/tags/*:refs/tags/*' echo -e "\nDone.\n" } function git_undo_changes() { echo -e "\nUndoing changes...\n" # Revert changes to modified files. git reset --hard # Remove all untracked files and directories. git clean -fd echo -e "\nDone.\n" } # Maintaining a Git Repository | Atlassian Documentation # https://confluence.atlassian.com/bitbucket/maintaining-a-git-repository-321848291.html function git_gc() { # Garbage collecting dead data # 1. Prune all of the reflog references from now on back # (unless you're explicitly only operating on one branch). git reflog expire --expire=now --all # 2. Repack the repository by running the garbage collector and pruning old objects. git gc --prune=now } #------------------------------

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.