Git

cheatsheet

Branches

List all local branches

git branch

List all merged branches

git branch --merged

Same as above but exclude master and develop branches

git branch --merged | egrep -v "(^\*|master|develop)"

Deleting branches

git branch -d branch_name

Delete remote branches

git push origin --delete branch1 branch2

Generate release notes

These release notes were generated using this script:

git log f5b38145...8c17d7a9 --pretty=format:'- **%s** ([%h](github.com/mrmartineau/notes.zander.wtf/commit/%H)) by %an' --reverse

To retrieve the git commit hashes use this:

git log --oneline

Tags

# list all git tags
git tag -l
git tag --list
# create a git tag
git tag v1.9.2
# remove a git tag
git tag -d v1.9.2
git tag --delete v1.9.2
# push all tags to remote
git push --follow-tags origin master

gitsheet.wtf

gitexplorer.com

Setting Up Git Identities

Branching strategies

GitHub flow

  • Anything in the master branch is deployable
  • To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request
  • After someone else has reviewed and signed off on the feature, you can merge it into master
  • Once it is merged and pushed to ‘master’, you can and should deploy immediately
Edit this page
Want to make your own site like this? Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My memory bank.