improved git flow
This commit is contained in:
@@ -25,6 +25,7 @@ in
|
|||||||
# Password management
|
# Password management
|
||||||
"1password"
|
"1password"
|
||||||
"1password-cli"
|
"1password-cli"
|
||||||
|
"bitwarden"
|
||||||
|
|
||||||
# Terminal & Development
|
# Terminal & Development
|
||||||
"ghostty"
|
"ghostty"
|
||||||
|
|||||||
@@ -248,8 +248,8 @@ in
|
|||||||
append = "commit --amend --no-edit";
|
append = "commit --amend --no-edit";
|
||||||
# Stage all and amend to last commit
|
# Stage all and amend to last commit
|
||||||
fix = "!git add . && git commit --amend --no-edit";
|
fix = "!git add . && git commit --amend --no-edit";
|
||||||
# Stage all, amend, rebase, and force push with lease
|
# Stage all, amend, and safely force push with lease and force-if-includes
|
||||||
fck = "!f() { git add . && git commit --amend --no-edit && git rebase origin/$(git rev-parse --abbrev-ref HEAD) && git push --force-with-lease; }; f";
|
fck = "!f() { git add . && git commit --amend --no-edit && git push --force-with-lease --force-if-includes; }; f";
|
||||||
# Stage all, commit with message, and push
|
# Stage all, commit with message, and push
|
||||||
save = "!f() { git add --all && git commit -m \"$*\" && git push; }; f";
|
save = "!f() { git add --all && git commit -m \"$*\" && git push; }; f";
|
||||||
|
|
||||||
@@ -260,8 +260,8 @@ in
|
|||||||
fix-commit = "!f() { commit=$(git log --oneline --color=always | fzf --ansi --height 40% | awk '{print $1}'); [ -n \"$commit\" ] && git add . && git commit --fixup=\"$commit\"; }; f";
|
fix-commit = "!f() { commit=$(git log --oneline --color=always | fzf --ansi --height 40% | awk '{print $1}'); [ -n \"$commit\" ] && git add . && git commit --fixup=\"$commit\"; }; f";
|
||||||
apply-fixes = "!f() { upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null); if [ -n \"$upstream\" ]; then git rebase -i --autosquash \"$upstream\"; elif git show-ref --verify --quiet refs/remotes/origin/main; then git rebase -i --autosquash origin/main; elif git show-ref --verify --quiet refs/remotes/origin/master; then git rebase -i --autosquash origin/master; elif git show-ref --verify --quiet refs/heads/main; then git rebase -i --autosquash main; elif git show-ref --verify --quiet refs/heads/master; then git rebase -i --autosquash master; else first_commit=$(git rev-list --reverse HEAD | head -1); if [ -n \"$first_commit\" ]; then base=$(git rev-parse \"$first_commit^\" 2>/dev/null); if [ -n \"$base\" ] && [ \"$base\" != \"$first_commit\" ]; then git rebase -i --autosquash \"$base\"; else echo \"Could not determine base. Usage: git apply-fixes <base-branch>\"; fi; else echo \"No base branch found. Usage: git apply-fixes <base-branch>\"; fi; fi; }; f";
|
apply-fixes = "!f() { upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null); if [ -n \"$upstream\" ]; then git rebase -i --autosquash \"$upstream\"; elif git show-ref --verify --quiet refs/remotes/origin/main; then git rebase -i --autosquash origin/main; elif git show-ref --verify --quiet refs/remotes/origin/master; then git rebase -i --autosquash origin/master; elif git show-ref --verify --quiet refs/heads/main; then git rebase -i --autosquash main; elif git show-ref --verify --quiet refs/heads/master; then git rebase -i --autosquash master; else first_commit=$(git rev-list --reverse HEAD | head -1); if [ -n \"$first_commit\" ]; then base=$(git rev-parse \"$first_commit^\" 2>/dev/null); if [ -n \"$base\" ] && [ \"$base\" != \"$first_commit\" ]; then git rebase -i --autosquash \"$base\"; else echo \"Could not determine base. Usage: git apply-fixes <base-branch>\"; fi; else echo \"No base branch found. Usage: git apply-fixes <base-branch>\"; fi; fi; }; f";
|
||||||
# Squash all commits unique to current branch (auto-detects default branch)
|
# Squash all commits unique to current branch (auto-detects default branch)
|
||||||
cleanup = "!f() { default=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
cleanup = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
||||||
squash-all = "!f() { default=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
squash-all = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
||||||
|
|
||||||
# Staging aliases
|
# Staging aliases
|
||||||
# =====
|
# =====
|
||||||
@@ -285,11 +285,11 @@ in
|
|||||||
# Fetch from all remotes
|
# Fetch from all remotes
|
||||||
fetch-all = "fetch --all";
|
fetch-all = "fetch --all";
|
||||||
# Pull latest changes
|
# Pull latest changes
|
||||||
pull-latest = "!f() { default=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git pull origin \"$default\"; }; f";
|
pull-latest = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git pull origin \"$default\"; }; f";
|
||||||
# Push and set upstream
|
# Push and set upstream
|
||||||
push-new = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD); }; f";
|
push-new = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD); }; f";
|
||||||
# Update from main/master (rebase)
|
# Update from main/master (rebase)
|
||||||
update-from-main = "!f() { default=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git rebase \"origin/$default\"; }; f";
|
update-from-main = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git rebase \"origin/$default\"; }; f";
|
||||||
|
|
||||||
# Stash aliases
|
# Stash aliases
|
||||||
# =====
|
# =====
|
||||||
@@ -305,7 +305,7 @@ in
|
|||||||
# =====
|
# =====
|
||||||
|
|
||||||
# Create new feature branch from main/master
|
# Create new feature branch from main/master
|
||||||
new-feature = "!f() { default=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git checkout -b \"$1\" \"origin/$default\"; }; f";
|
new-feature = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git checkout -b \"$1\" \"origin/$default\"; }; f";
|
||||||
# Compare current branch with another branch
|
# Compare current branch with another branch
|
||||||
compare = "!f() { git diff \"$1\"..HEAD; }; f";
|
compare = "!f() { git diff \"$1\"..HEAD; }; f";
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,7 @@
|
|||||||
age # Modern encryption tool
|
age # Modern encryption tool
|
||||||
sops # Secrets management
|
sops # Secrets management
|
||||||
rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative.
|
rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative.
|
||||||
|
bitwarden-cli
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Miscellaneous Tools
|
# Miscellaneous Tools
|
||||||
@@ -130,6 +131,7 @@
|
|||||||
mob
|
mob
|
||||||
zsh-fast-syntax-highlighting
|
zsh-fast-syntax-highlighting
|
||||||
jellyfin-tui
|
jellyfin-tui
|
||||||
|
mpv
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Nix Tools
|
# Nix Tools
|
||||||
|
|||||||
Reference in New Issue
Block a user