Skip to content

Latest commit

 

History

History
134 lines (97 loc) · 3.83 KB

git.md

File metadata and controls

134 lines (97 loc) · 3.83 KB

Getting sarted with Git

Setting Up Git

git should be provided on most Unix systems by default.

  • If you are working with Windows, we recommend using the git plugin in VSCode.
  • If you are working with OSX, we recommend updating git via Homebrew
  • If you are working with Linux, make sure to update git via the package manager on your distro (ex: apt on Ubuntu)

Make sure you have two-factor auth setup in Github. This is a requirement for working with any repository in Otrego.

Fork and Pull Request Model

We expect all developers, both external contributors and maintainers to interact with Clamshell via a fork-and-pull-request model. So generally, developers will fork the Clamshell repository and then submit pull requests to the primary otrego/clamshell repository.

Workflows

Getting a Repository Set Up

Assuming you have created a fork of Clamshell (see Getting Started with Git), then create the relevant directories & clone the repo:

git clone github.com/<USERNAME>/clamshell

Set the upsteams appropriately:

cd clamshell
git remote add upstream [email protected]:otrego/clamshell.git

Check everything's set up correctly:

git remote -v

Update your repository with latest upstream changes from otrego/clamshell

git pull upstream master

Update your remote repository on github with latest upstream changes

git push

Making a Change and Making a Pull Request

The general flow looks lishould be:

  1. Do development on branches in your fork.
  2. Make pull requests to the main repo otrego/clamshell
  3. Get your code reviewed by a team member.
  4. Once approved, submit the changes.

Specifically, here's a full example workflow:

  1. Merge any upstream changes into master.

    git checkout master
    git fetch upstream
    git merge upstream/master
    
    # update my fork's master branch.
    git push
  2. Do feature development on a branch

    git checkout -b somefeature
    # ... do some work
    git add -A .
    git commit -a
    git push origin somefeature
  3. (Optional) If much time has passed, make sure your local master & feature branches are updated, running through 1. and then rebasing on top of that.

    git checkout master
    git fetch upstream
    git merge upstream/master
    git push
    
    # Update feature branch
    git checkout somefeature
    git merge master
    
    git push
  4. When your change is ready, use the Github UI to get code reviewed & merge the changes into the repository:

    1. Perform pull request via Github UI from your repsitory + feature branch to Github.

    2. Get code reviewed by team member in Github UI. If you are reviewing code, make sure to 'Approve' the change.

    3. Sqaush into single commit via Github UI and merge into the repository (this should happen by default.).

Resources

  1. The Git Book. In particular, I find these sections very helpful:
    1. Basic Branching & Merging
    2. Distributed Workflows. Specifically, we use an Integration-Manager workflow (Github) in Otrego repositories.
  2. Getting Started with Github