Skip to content

Instantly share code, notes, and snippets.

@Aissaoui-Ahmed
Last active July 26, 2023 10:57
Show Gist options
  • Save Aissaoui-Ahmed/bd2429bb51b299f746f847eb8815e156 to your computer and use it in GitHub Desktop.
Save Aissaoui-Ahmed/bd2429bb51b299f746f847eb8815e156 to your computer and use it in GitHub Desktop.
git alias
[alias]
co = "!f() { git stash; git checkout \"$@\"; git stash pop; }; f"
cob = "!f() { git stash; git checkout -b \"$@\"; git stash pop; }; f"
br = branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate
done = !git push origin HEAD
pll= !git pull origin HEAD
lg = !git log --name-only --pretty=format:\"%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) [%an]\" --abbrev-commit -30
undo = reset HEAD~1 --mixed
del = branch -D
s = status
ignore= "!sh ~/ignore.sh"
#!/bin/bash
lang=$1
if [ ! -n "${lang##+([[:space:]])}" ]; then
echo 'Please add programming language'
fi
langUpperCase=$(echo $lang |sed 's/./\u&/')
curl -s "https://raw.githubusercontent.com/github/gitignore/main/${langUpperCase}.gitignore" --output .gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment