Skip to content

Instantly share code, notes, and snippets.

View peternann's full-sized avatar

Peter Nann peternann

View GitHub Profile
@patik
patik / git-setup.sh
Created November 13, 2015 13:24
Git and Node with Zscaler proxy
#!/bin/sh
# Git proxy settings
echo "Configuring Git..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
git config --global http.sslVerify false
git config --system http.sslVerify false
git config --global --unset http.sslcainfo
git config --system --unset http.sslcainfo
@bingzhangdai
bingzhangdai / git_branch.md
Last active January 7, 2024 17:31
Fasted way to get git branch

Sometimes, we want to show current git branch in Bash prompt. git symbolic-ref --short -q HEAD is too slow, especially in WSL. Here is a pure Bash version to print git branch.

function _get_git_branch() {
    local _head_file _head
    local _dir="$PWD"

    while [[ -n "$_dir" ]]; do
        _head_file="$_dir/.git/HEAD"
        if [[ -f "$_dir/.git" ]]; then