File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # git-switch-default - Switch to the remote default branch
3+
4+ # Get default branch name (from local cache without remote access)
5+ default_branch=$( git symbolic-ref refs/remotes/origin/HEAD 2> /dev/null | sed ' s@^refs/remotes/origin/@@' )
6+
7+ # Exit if symbolic reference is not found
8+ if [ -z " $default_branch " ]; then
9+ echo " Error: refs/remotes/origin/HEAD does not exist."
10+ exit 1
11+ fi
12+
13+ git switch " $default_branch "
Original file line number Diff line number Diff line change 4949
5050- name : Setup git-completion
5151 ansible.builtin.include_tasks : setup_git_completion.yml
52+
53+
54+ - name : Install custom commands script
55+ ansible.builtin.copy :
56+ src : git-switch-default
57+ dest : /usr/local/bin/git-switch-default
58+ mode : ' 0755'
You can’t perform that action at this time.
0 commit comments