Skip to content

Instantly share code, notes, and snippets.

@seunggabi
Last active November 2, 2024 05:14
Show Gist options
  • Save seunggabi/87f8c722d35cd07deb3f649d45a31082 to your computer and use it in GitHub Desktop.
Save seunggabi/87f8c722d35cd07deb3f649d45a31082 to your computer and use it in GitHub Desktop.
Semantic Branch Names

Semantic Branch Names

See how a minor change to your branch name style can make you a better programmer.

Format: <type>/#<issueNumber>-<alias>

Example

feature/#1-init
^------^   ^---^
|          |
|          +---> issue's keyword
|
+-------> Type: or feat, chore, docs, fix, refactor, style, or test.

More Examples:

  • feat or feature: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)

References:

@palm002
Copy link

palm002 commented Nov 10, 2021

Interesting idea! 👏
Somewhat reminds me of gitflow

@seunggabi
Copy link
Author

@palm002 thx

@seunggabi
Copy link
Author

seunggabi commented May 27, 2022

@palm002 @joshbuchea

https://gist.github.com/seunggabi/8fa40a3585d37519db5beab5f0563766

I recommend this prepare-commit-msg

start

  • repository
cp prepare-commit-msg .git/hooks/prepare-commit-msg
chmod a+x .git/hooks/prepare-commit-msg
  • global
mkdir -p ~/.git-templates/hooks
git config --global init.templatedir '~/.git-templates'
cp prepare-commit-msg ~/.git-templates/hooks/prepare-commit-msg
chmod a+x ~/.git-templates/hooks/prepare-commit-msg

# each repository
git init

example

git commit -m "feat: add prepare-commit-msg"

branch: feature/DT-1252_#3_prepare-commit-msg
commit: [DT-1252] (#3) feat: add prepare-commit-msg

branch: feature/DT-1252_prepare-commit-msg
commit: [DT-1252] feat: add prepare-commit-msg

branch: feature/#3_prepare-commit-msg
commit: (#3) feat: add prepare-commit-msg

@GyuminJack
Copy link

git commit -m 'feat: add prepare-commit-msg' -> branch :feature/DT-1252_#3_prepare-commit-msg

commit: [DT-1252] (#3) feat: add prepare-commit-msg

@gabrielpaiva-bycoders
Copy link

Hello!

If I'm creating a POC or studying something before start making a feature, what type this branch should be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment