All our projects use Git, and most live on GitHub. Here are the defaults we follow.
The Workflow
Section titled “The Workflow”Don’t touch the main branch directly, especially on a live project. During development, use a dev branch or feature branches. Merge into the project via a Pull Request, then delete the branch.
Repo Naming
Section titled “Repo Naming”Repo names should be lowercase and use kebab-case for multiple words.
- Bad:
https://www.luckymedia.dev,www.luckymedia.dev,LuckyMedia.dev,LuckyMedia - Good:
luckymedia.dev,lucky-media
Branches
Section titled “Branches”During development, we start with main and dev. Once the project is live, we switch to feature branches.
Feature Branches
Section titled “Feature Branches”No strict naming rules, but the name should reflect what you’re working on. Use lowercase and use kebab-case.
- Bad:
feature/section,feature-develop,feature - Good:
feature-header,fix-responsive-issue,chore-dependency-updates
Commits
Section titled “Commits”No hard rules, but commit messages should be meaningful.
- Bad:
wip,commit,changes,small change - Good:
fixed responsive issue on header,updated dependencies,updated contact section
Pull Requests
Section titled “Pull Requests”Once the feature is done, open a pull request so a teammate can review it. We don’t have a strict review policy, but having another pair of eyes is always a good idea. Keep these in mind:
- Name the PR to reflect the work.
- Add a short description of what you did.
- If you want specific feedback on something, ask for it.
Git Tips
Section titled “Git Tips”Create a new git repo, commit, and push to Github.
Section titled “Create a new git repo, commit, and push to Github.”git initgit add . && git commit -m "Initial commit"## if your default is master, switch to main.git branch -M maingit remote add origin https://github.com/lucky-media/repo-name.gitgit push -u origin mainCreate a new branch with changes.
Section titled “Create a new branch with changes.”git switch -c branch-nameRemove all commit history and start afresh
Section titled “Remove all commit history and start afresh”# clone the repogit clone git@github.com:USERNAME/REPOSITORY.gitcd REPOSITORY
# remove all history locallyrm -rf .git
# create a new local repogit init
# add everythinggit add .git commit -m "First commit"
# erase history on GitHub (irreversible)git remote add origin git@github.com:USERNAME/REPOSITORY.gitgit push -u --force origin main