Skip to content

Commit

Permalink
git: add a git fork command to set up forks
Browse files Browse the repository at this point in the history
- Create a new fork with remote name "fork".
- Create a new branch "oldmaster" mirroring "up/master".
- Make "oldmaster" the default branch.
- Clean all other branches and tags from the fork.
  • Loading branch information
gibfahn committed Jan 29, 2020
1 parent 5a5f0b9 commit ea65d38
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dotfiles/.config/git/config
Expand Up @@ -3,6 +3,8 @@
# N.B. # at end of func allows parsing $1 args.

# Helper functions where a full name is easier:
# Set up a fork the way I like it:
fork = "! hub fork --remote-name=fork && git remote -v && git push fork master:refs/heads/oldmaster && git change-branch && git default-branch fork && git clean-fork #"
# Change the remote default branch to "$1" (default: "oldmaster"), for remote $2 (default: "fork").
change-branch = "!hub api -XPATCH repos/$(git remote-org ${2:-fork})/$(git remote-repo ${2:-fork}) -f name=$(git remote-repo ${2:-fork}) -f default_branch=${1:-oldmaster} && git remote set-head --auto ${2:-fork} #"
# Removes all branches and tags except "$1" (default: oldmaster).
Expand Down

0 comments on commit ea65d38

Please sign in to comment.