GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — git-friendly/merge at main · git-friendly/git-friendly Expand file tree/ Copy pathmergeMore file actions executable file ·47 lines (40 loc) · 1.45 KB / Copy pathmergeFile metadata and controlsexecutable file ·47 lines (40 loc) · 1.45 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 #!/bin/bash # # Usage: merge [branchname] # # Tries to merge local branch "branchname" into the current branch # It will stop you if you are behind & need to pull 1st # remote="origin" branch=$1 if [ -z "$branch" ]; then echo "Usage: $0 [branchname]" exit 1 fi # Abort if this isn't a git repository git rev-parse --is-inside-work-tree >/dev/null || exit $? current_branch=$(git branch --show-current) if [ -z "$current_branch" ]; then echo "❌ You're not on a branch (detached HEAD). Check out a branch first." >&2 exit 1 fi # If there is a remote version of this branch, rebase onto current_branch first # If there's a remote (public) branch, we do not want to be rewriting histories tracking=$(git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) if [[ "$tracking" != "$remote"/* ]]; then echo "⚒ Local-only branch, rebasing $branch onto $current_branch first..." # Bail if the switch fails. Carrying on would rebase whichever branch we # were left standing on, which is silently the wrong one. git switch "$branch" || exit 1 git rebase --autostash "$current_branch" || exit 1 else echo "📡 This branch exists remotely, not rebasing" fi echo "✂️ Merge $branch into $current_branch" git switch "$current_branch" || exit 1 # --autostash shelves and restores local changes, so a dirty file that # neither side of the merge touches no longer blocks it git merge --autostash "$branch" || exit 1 echo echo "🦄 Done" exit 0 |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |