Skip to content

Instantly share code, notes, and snippets.

@gwenn
Last active March 28, 2025 07:05
Show Gist options
  • Save gwenn/7e2ee3fa1d0c7382f2ed9615da6cf63a to your computer and use it in GitHub Desktop.
Save gwenn/7e2ee3fa1d0c7382f2ed9615da6cf63a to your computer and use it in GitHub Desktop.
git config
[user]
name = Your Name
email = [email protected]
[color]
# diff = auto
# status = auto
# branch = auto
ui = auto
[alias]
ci = commit
st = status
br = branch
co = checkout
df = diff
[tool]
# pager = less -FRX
# merge = vimdiff
[push]
default = simple
[pull]
rebase = true
[rebase]
autostash = true
#[commit]
# template = .stCommitMsg
[core]
# autocrlf = true
for repo in "${repos[@]}"
do
echo "$repo"
git -C "$repo" branch -vv
done
for repo in "${repos[@]}"
do
echo "$repo"
git -C "$repo" status --untracked-files=no --short
done

Git

Cherry pick

git cherry-pick -m1 <merge commit>

Branch

create remote branch

git push origin origin/master:refs/heads/<name>

rename remote branch

git push origin origin/<old_name>:refs/heads/<new_name> :<old_name>

delete remote branch

git push --delete origin <name>

Tag

list tags

git tag --sort=-creatordate | head

find commit associated to one tag

git rev-list -n 1 <tagname>

delete tag

git tag -d <name>
git push --delete origin <name>

Stats

git shortlog -sn --no-merges
repos=(
dir1
dir2
...
)
for repo in "${repos[@]}"
do
echo "$repo"
git -C "$repo" branch --show-current
git -C "$repo" remote update -p
git -C "$repo" pull
git -C "$repo" fetch origin master:master
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment