Giter Club home page Giter Club logo

git-etiquette's Introduction

Git Etiquette

Branching & Merging Guidelines

Setup repository with a master branch and a dev branch. dev should be made the default branch.

All development should be worked on in respective branches and merged into dev. See branch naming and merging guidelines below.

Master should contain the most recent published/released copy. See merging guidelines below.

Branch Naming

category/master

category/github_username/short_description

  • category examples: sample_code, guidebook

    • keep this consistent within a project

    • each category should have its own master branch

  • short_description should explain what github_username is working on in that branch

Merging Guidelines

Pull Requests

Creating a pull request

Merging a pull request

Merge Cases

Merging user branches into category/master branches
  1. Pull request: select merge pull request option

  2. Via command line: Using merge will maintain the true history of the development work.

git checkout category/github_username/short_description

git merge category/master
Merging category/master branches into dev
  1. Pull request: select squash and merge option

  2. Via command line: Using rebase will maintain a linear timeline for clarity. Squash new commits into one during the interactive rebase.

git checkout category/master

git rebase -i dev

Merging dev into master

  1. Pull request: select merge pull request option

  2. Via command line:

git checkout dev

git merge master

Reference Material

Proposing changes to your work with pull requests

Commit Messages

Git commit messages should be thought out and not rushed. This message provides other users with a way to understand what changes you made in your commit.

A proper git commit message should follow a standard format.

The standard commit message is as follows:

type(category): subject — footer for example: feat(guidebook): added title-page

Type

  • feat — A new feature.

  • fix — A bug fix.

  • docs — Changes to only documentation.

  • style — Changes to formatting (missing semicolons, etc.).

  • refactor — A code change that neither fixes a bug nor adds a feature.

  • test — Adding missing or correcting existing tests.

  • chore — Change to build process or auxiliary tools, or maintenance.

Category

This should correspond with the branch names.

Subject

The subject should be limited to 50 characters and be descriptive of the changes. If there are multiple things changed, consider splitting into smaller commits (use git add -p).

Reference Material

Git Workflow Etiquette - Better Programming

Useful Git Commands

git add -p                 # stage only some changes within file(s)

git rebase -i HEAD~n       # can be used to squash last n commits

git reset --soft HEAD^     # undoes the last commit and saves stage

git stash, git stash pop   # temporarily saves local changes

git-etiquette's People

Contributors

dgaiero avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.