pull down to refresh

I just added pl and pu recently, annoyed with the default behavior of a pull/push when you don't specify a remote and a refspec. It made me curious what aliases stackers are packing.
[alias]
	co = checkout
	br = branch
	ci = commit
	st = status
	lg = log --oneline
	pl = !git pull $(git config branch.$(git name-rev --name-only HEAD).remote) $(git config branch.$(git name-rev --name-only HEAD).merge)
	pu = !git push $(git config branch.$(git name-rev --name-only HEAD).remote) $(git branch --show-current):$(git config branch.$(git name-rev --name-only HEAD).merge)
[alias]
	rb = rebase -S
	co = checkout
	ci = commit -S
	ic = commit -S
	cp = cherry-pick -S
	br = branch
	st = status
	lg = log --graph --format='%C(yellow)%h%Creset -%C(auto)%d%Creset %s %C(green)(%ar) %C(cyan)<%an>%Creset'
	branches = branch -a
	desc = describe
	last = log -1 HEAD
	pom = pull origin master
	remotes = remote -v
	tags = tag -l
	unstage = reset HEAD --
	ft = fetch --all
	rs1 = reset --soft HEAD~1
	rs2 = reset --soft HEAD~2
	rs3 = reset --soft HEAD~3
	rs4 = reset --soft HEAD~4
	rs5 = reset --soft HEAD~5
	rs6 = reset --soft HEAD~6
	rs7 = reset --soft HEAD~7
	rs8 = reset --soft HEAD~8
	rs9 = reset --soft HEAD~9
	rh = reset --hard
	rh1 = reset --hard HEAD~1
	rh2 = reset --hard HEAD~2
	rh3 = reset --hard HEAD~3
	rh4 = reset --hard HEAD~4
	rh5 = reset --hard HEAD~5
	rh6 = reset --hard HEAD~6
	rh7 = reset --hard HEAD~7
	rh8 = reset --hard HEAD~8
	rh9 = reset --hard HEAD~9
	df = diff --compact-summary master
	oc = checkout
	ps = push
	psh = push
	phs = push
	psuh = push
	phus = push
	phsu = push
	puhs = push
	push-f = push -f
	puhs-f = push-f
	push0f = push -f
	puhs0f = push -f
	add-p = add -p
	ds = diff --staged
also have this to pull in the lastest version of a branch from upstream
function update() {

git fetch --multiple upstream origin

if [ -n "$1" ]
then
  git checkout $1
  git merge remotes/upstream/$1
else
  git checkout master
  git merge remotes/upstream/master
fi

git push -f

}
reply
My favorite that makes me chuckle when I have to use it in the clown world with my clients is git commies
I'll steal your pl and pu (no idea how that magic works but looks cool) @k00b
[alias]
  co = checkout
  cob = checkout -b
  com = checkout master
  commies = checkout main
  st = status
  adddd = add -A
  cim = commit -m
  pushoo = push origin HEAD
  br = branch
  po = pull origin
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p
  ws = diff --check
	ciam = !git add -A && git commit -n -m
  pulloo = pull origin
  rename = branch -m
  showalias = config --get-regexp alias
  delete = branch -D
  f = fetch
  edit = config --global --edit
	undo = reset HEAD~
reply
Here are some bash aliases for git. Need to cull this list as well.
gclean is pretty handy if you hate having a ton of old branches locally. It lists all merged branches and deletes the local branches that have been merged.
# Git
alias ungit="find . -name '.git' -exec rm -rf {} \;"
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gf='git fetch'

if [ $(uname) == "Darwin" ]; then
  alias gcb="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy"
fi

if [ $(uname) == "Linux" ]; then
  alias gcb="git branch | grep '^\*' | cut -d' ' -f2 | xclip -sel c"
fi

# Commit pending changes and quote all args as message
function gg() {
    git commit -v -a -m "$*"
}
alias gco='git checkout'
alias gcod='git checkout develop'
alias gcob='git checkout -b'
alias gd='git diff'
alias gdm='git diff master'
function gdx() {
  git diff $1 $2 | gitx
}
alias gl='git pull'
alias gnp="git-notpushed"
alias gp='git push'
alias g='git status'
alias ga-modified="git status | grep modified | cut -d':' -f2 | xargs git add"

# Get and merge upstream repo
alias gups='git fetch upstream && git merge upstream/master'
alias eg='vim .git/config'
alias egg='vim ~/.gitconfig'

# Lists all merged branches and deletes the local branchs
alias gclean="git branch --merged | grep -v -i -E 'master|main|develop' | xargs -n 1 git branch -d"
reply
Been a while since I have audited my git config. Need to cull the herd...
Several of these I used in previous jobs and never use any more. Still have some MacOS style ones with pbcopy (though I do have an alias to xclip on Linux).
[alias]
  br = branch
  ci = commit
  co = checkout
  datetag = !git tag `date "+%Y_%m_%d_%H%M"`
  df = diff

  # Show modified files in last commit.
  diffall = diff HEAD
  diffstaged = diff --staged
  nextrelease = log origin/dev ^origin/main --no-merges
  dl = "!git ll -1"

  # Show a diff last commit.
  dlc = diff --cached HEAD^
  filelog = log --oneline --no-merges --
  fl = log -t u
  init = init --template ~/.git_template

  # List oneline commits showing relative dates.
  ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative

  # List oneline commits showing dates.
  lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
  lg = log -p

  # List commits showing changed files is invoked with git ll and looks like this.
  ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
  logm = log --author="kepford" --decorate
  lol = log --graph --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
  lola = log --graph --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --all
  lolm = log --author="kepford" --decorate --pretty=oneline --abbrev-commit
  ls = ls-files

  # Copies today's commits by me on a branch.
  today = "!git log --since=6am --author="kepford" --decorate --abbrev-commit | grep -vwE \"(Author:|Date:)\" | pbcopy | pbpaste | cat"
  sa = stash apply
  sl = stash list
  ss = stash save
  st = status

  # Commits on current branch. Assumes the branch was created from develop.
  thisbranch = log --no-merges dev..
  undolast = reset --soft Head^
  unstage = reset HEAD

  # diff-highlight http://theunixtoolbox.com/git-diff-highlight/
  worddiff = !git diff --color | diff-highlight | less -r
reply
I like a simpler status, so adding -sb to my status alias.
Also, saw this one once which I find handy!
	se = !git rev-list --all | xargs git grep -F
reply
200 sats \ 0 replies \ @ek 9 Aug 2024
[alias]
  i = "!f(){ git init && git commit -m 'initial commit' --allow-empty; };f"
  s = status -sb
  l = log -10 --oneline
  rl = reflog -10
  cb = checkout -b
  b = branch
  bd = branch -d
  ch  = "!f(){ git checkout --quiet \"$1\" && git status; };f"
  a = add
  aa = "!f(){ git add --all && git status; };f"
  co = commit
  oc = commit
  f = fetch
  d = diff
  ds = diff --staged
  pr = pull --rebase
  rbi = rebase --autosquash -i
  ca = commit --amend
  r = reset
  excl = "!f(){ [ ! -z \"$1\" ] && echo \"$1\" >> .git/info/exclude; };f" # TODO: support multiple arguments with shift
  readd = "!git diff --staged --name-only | xargs git add"
  rd = "readd"
  fixup = commit --fixup
I especially like the common typo oc for co
reply
[alias]
  co = checkout
  cob = checkout -b
  coo = !git fetch && git checkout
  br = branch
  brd = branch -d
  st = status
  aa = add -A .
  unstage = reset --soft HEAD^
  cm = commit -m
  cma = commit -am
  amend = commit --amend -m
  fix = commit --fixup
  undo = reset HEAD~1
  rv = revert
  cp = cherry-pick
  pu = !git push origin `git branch --show-current`
  fush = push -f
  mg = merge --no-ff
  rb = rebase
  rbc = rebase --continue
  rba = rebase --abort
  rbs = rebase --skip
  rom = !git fetch && git rebase -i origin/master --autosquash
  save = stash push
  pop = stash pop
  apply = stash apply
  rl = reflog
I got them from somewhere, I don't remember, In fact I just realized I never use them at all, it was just lying around in my git config, I'm a simple git user and rarely need any of those. It also helps that I'm using fish as my shell, the autocompletion is fantastic I never worry about repeating long commands.
reply
Great idea for a post. I could do several like this on different things. Thanks for sharing @k00b. Love stuff like this.
reply
I was adding these, then I recalled how useful my existing ones were, then it occurred to me to just ask if anyone had any good ones too.
These kinds of discussions, where the participation effort has been stored (e.g. config files or memories) and doesn't require much effort to participate in in the moment, are usually very fruitful.
reply
This is cool. I am not an engineer but I am fascinated by the way engineers make notes to themselves within code or things like this where they make their own abbreviations that are unique to their own style.
Very inside baseball.
reply
There are tradeoffs. It can be a crutch to make an alias if you ever have to use a system without your aliases. But there's always the Internet
reply
Awesome idea! I'm going to definitely borrow some of these!
reply
apparently I do it backwards, use vscode for git and aliases for "ci"
alias authdeploy='cd ~/auth && git pull && cd client && npm run build && cd .. && sudo systemctl restart auth'
reply
Oh man I have a bunch. I'll work to share them here soon
reply
@remindme in 3 hours to share my git aliases
reply
deleted by author