This repo contains my git aliases and scripts. Feel free to use them.
To use the aliases, copy the contents of /alias-core/git-workflow-aliases into your .gitconfig.
To use the scripts as aliases, move the contents of the /scripts/ folder into your $PATH.
The scripts enforce Git Flow, but they use development branch name "next" instead of "dev".
| Command | Description |
|---|---|
git s: |
short status |
git lg: |
beautiful graph/log |
git graph: |
ugly graph/log |
git aa: |
git add . |
git au: |
add tracked / modded files |
git sync [branch]: |
update a branch to the remote |
git sq [branch]: |
squash commits: git rebase -i next |
git c [message]: |
commit wrapper |
git qc [p] [message]: |
smart Git Flow commit, and push to current remote branch |
git b [subcommand] [args]: |
use the branch commands |
git b start [topic/release/hotfix] [name/tag]: |
start branches automatically for Git Flow strategy |
git b finish: |
run from the branch you want to finish, detects if release: merge to main and next, else merge to next |
git b start [t/h/r] [name/version]
- This command will start a topic branch, release branch, or hotfix branch.
-
Firstly, the alias errors out if you have untracked files because autostash can't stash them properly.
-
topic:- Switch to next
- fetch and pull --rebase --autofetch
- Create topic branch as named and push to remote.
-
hotfix:- Switch to main
- fetch and pull --rebase --autofetch
- Create
hotfix/[tag]branch and push to remote
-
release:- Switch to next.
- fetch and pull --rebase --autofetch
- Create
release/[tag]branch and push to remote
git b finish [branch name]
- This command will automatically handle merging a topic branch, release branch, or hotfix branch.
- It detects the branch you are trying to finish, and asks for confirmation (errors out if you try to finish main or next)
-
Errors out if you have untracked files.
-
Handles branching strategy.
-
NOTE: needs work, currently may fail if it can't complete a fast forward from main to next.
-
topic:- Switch to next
- Non-FF merge the topic into next to maintain history
- Push and echo the command to delete (will be automated when I move these into scripts)
-
hotfixorrelease:- Switch to main
- Non-FF merge the hotfix or release branch into main branch
- Create new version tag
- Push and echo the command to delete (will be automated when I move these into scripts)
git b delete [name optional] [-y to skip confirmation - must use name]
- This deletes the named branch or the current branch if you don't provide a name.
- Asks for confirmation unless you pass something like yes or -y. To skip confirmation, you have to reference the branch by name or it won't work.
- Prohibits deletion of
mainandnextbranches. - Error out if you have untracked files in the branch (PLANNED: -D to skip this check)
- automatically switches to next if you are in the branch you want to delete, and switches back if you abort.
- Deletes local and remote.
git qc ['p' flag]"Message"
- If you don't provide a message, it reads a response from you. It will abort with an empty response.
- If the branch is on the remote it updates the local version with pull --rebase --autostash.
- If no staged changes, prompts for
git add -A, commits with the given message, and pushes to current branch on the remote. - 'p' flag makes it auto push.
git ps ['force' flag]
- By default, wraps
git push -u origin [current branch] - pass 'force' to run
git push --force-with-lease origin [current branch]
git sync [name optional]
- Switches to the named branch if you defined one.
- Stashes untracked files in the selected branch.
- do git pull --rebase to update the local copy of the branch.
- Pops untracked files out of stash (not autostash).