Skip to content

Commit

Permalink
git dev helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
basejump committed Jun 27, 2022
1 parent 833a217 commit 134192a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ include $(SHIPKIT_MAKEFILES)/git-tools.make
include $(SHIPKIT_MAKEFILES)/ship-version.make
include $(SHIPKIT_MAKEFILES)/circle.make
include $(SHIPKIT_MAKEFILES)/bats-testing.make
include $(SHIPKIT_MAKEFILES)/git-dev.make

# -- Variables ---
export BOT_EMAIL ?= [email protected]
Expand Down
64 changes: 64 additions & 0 deletions makefiles/git-dev.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -------------
# helpers for git dev
# -------------

# git checkout branch and pull, set b=<branch>
g.switch-pull:
git switch $(b)
git fetch --prune origin
git pull

g.dev.switch-pull:
make g.switch-pull b=dev

g.master.switch-pull:
make g.switch-pull b=master

g.branch.new:
read -p "branch name: " bname
git switch -c "$$bname"

# adds all changes, commits and push
g.commit.push:
git status
read -p "The files above will be commited. Commit Message: " msg
git add -A
git commit -m "$$msg"
# -u @ does the work of creating branch on github if it doesnt exist
git push origin -u @

# new pull request for current branch against dev
g.pr.new:
hub pull-request -o -b dev

# pull request for current branch.
g.pr.show:
hub pr show

# creates new master-dev-merge branch and opens pr
g.master-dev-merge:
git switch master
git pull
git switch -c master-dev-merge
git merge --no-commit --no-ff dev
git commit -m "merged dev"
git push origin -u @
# create pr and open page
hub pull-request -o --base master -m "dev master merge"

# resets dev to be at master, run after done releasing
g.master-dev-reset:
git switch master
git fetch --prune origin
git pull
git switch dev
# back up dev
git pull
git switch -c "dev-$$(date "+%Y-%m-%d")"
# switch back to dev
git switch dev
git reset --hard origin/master
git fetch origin
git pull --no-commit --no-rebase --no-ff origin dev
git commit -m "hard reset to master HEAD"
git push origin refs/heads/dev:refs/heads/dev

0 comments on commit 134192a

Please sign in to comment.