Skip to content

Conversation

@geoffjay
Copy link
Owner

@geoffjay geoffjay commented May 6, 2025

Adds a git-sync command to perform the equivalent of:

x-repo = !"f() { git config --get remote.origin.url | sed 's/^.*\\:\\(.*\\)\\.git/\\1/'; }; f"
x-fetch-all = fetch --no-tags --all -p
x-fetch-branch = !"f() { git fetch origin $1:$1; }; f"
x-merge-ff = merge --ff-only
x-branch-current = rev-parse --abbrev-ref HEAD
x-branch-default = !"f() { git remote show origin | grep HEAD | awk '{print $3}'; }; f"
x-branch-tidy = "!f() { git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -n 1 git branch -D; }; f"
up = \
!"f() { \
  current=$(git x-branch-current); \
  default=$(git x-branch-default); \
  git x-fetch-all && \
  (git x-merge-ff || true) && \
  git x-branch-tidy && \
  if [ \"$current\" != \"$default\" ]; then git x-fetch-branch $default; fi; \
}; f"

@geoffjay geoffjay merged commit f9c4c59 into main May 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants