Teagan Glenn
Teagan42
Senior Automation Consultant
Turnberry Solutions
Comcast
Tab completion for:
zsh | bash | sh
git bisect start; git bisect good
git bisect bad
git bisect bad
git bisect good
(It's really not that scary)
Git rerere stands for “reuse recorded resolution”. The idea is that git remembers how you chose to resolve hunk conflicts and applies them again in the future instead of having you resolve them again manually. This is particularly handy for long lived “feature” branches away from the “master” branch. With rerere enabled you can periodically perform a merge, resolve the conflicts then back out of the merge. Git will remember how you resolved the conflicts along the way. When it’s time to merge (where you would normally have to go through many conflicts) git will apply all the fixes you applied in the past manually greatly simplifying the merge process.
# To enable rerere globally:
git config --global rerere.enabled true
# To enable rerere locally:
git config rerere.enabled true
# show pre-merge recorded state
git rerere status
# will show the current state of the resolution
git rerere diff
# Fix the conflicts and add and commit the conflicted file
git add conflicted_file
git commit
# Reset the changes as rerere has saved them
git reset --hard HEAD^
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-rebase
post-checkout
post-merge
pre-push
pre-receive
post-update
push-to-checkout
pre-auto-gc
post-rewrite
rebase
sendemail-validate
post-index-change
update
post-receive
#!/bin/bash
# Include any branches for which you wish to disable this script
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop staging test)
fi
# Get the current branch name and check if it is excluded
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
# Trim it down to get the parts we're interested in
TRIMMED=$(echo $BRANCH_NAME | sed -e 's:^\([^-]*-[^-]*\)-.*:\1:' -e \
'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
# If it isn't excluded, preprend the trimmed branch identifier to the given message
if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]]; then
sed -i.bak -e "1s/^/$TRIMMED /" $1
fi
Did you know Jira watches GitHub for references to the story?
If you add your story to your commit, all of your work will be reflected inside the story!
Here is an example of adding your branch to the commit message
#!/bin/bash
cd $GIT_DIR
source venv/bin/activate
# Verify linting
pylint --rcfile=.pylintrc ./**/*.py
if [ $? -ne 0 ]; then
return 1
fi
# Run tests
py.test ./**/.py
return $?
Never commit failing code by forcing your linting and testing to run before being allowed to commit!