Giter VIP home page Giter VIP logo

teamgit's Introduction

Team Git

Resources

Git SCM Git Workflows

Benefits of Git

  • When used properly Git allows us to modify our source code WITHOUT looking at it!
  • Spend less time managing the code

Team Work Flow

DO NOT WORK ON MASTER EVER!!!!!!!!!

  1. Branch from a source of truth (typically master, but sometimes dev - in the case of IBM)
  2. Create a new branch (either on your terminal and then push - see below - or using the github interface - see below)
  3. Open a PR after your first commit and push (add relavent labels, and project information)
  4. Do work...commit very often (preferablly more often) and push to the corresponding branch
  5. When you're done request a reviewer in the PR.
  6. After the PR is approved merge using (squash and merge)

Practice

We're the team "NAME-IT!" and our job as namers are to record names of people.

  1. Create a new branch and PR. Name the branch create-<your-first-name For example:
git checkout -b create-noah
git push origin -u create-noah # I'll use the printed link to create a new PR
  1. If you're in the terminal:
cd practice
  1. Create a new file with your first name in lowercase (and no file extension). For example:

    touch noah # remember we're in the practice/ directory
    
  2. Print your favorite food and current city in the file in the format:

    { "favoriteFood": "pizza",
      "city": "Atlanta"
    }
    

Creating a new Branch

New Branch On Github.com

  1. Refer to here their official docs (make sure to select the dev or `master branch!)

  2. On your local machine:

    git fetch origin
    git checkout -t origin/<new-branch-name>
    

New Branch On Your Local Machine

Follow the steps below (assuming you're on a clean working directory)

git checkout master
git pull origin master
git checkout -b <new-branch-name>
git push origin -u <new-branch-name>

Github sends a link in the push message to a new PR. Use that to open a new pull request.

When To Create a New Branch From Master

These changes are...

  • New feature
  • New bug fix
  • Testing / playing around
  • Changes that might be needed across multiple braches

Keeping Up to Date With the single source of truth

  1. Use git rebase instead of git merge when pulling in changes from master.
A <- B <- C <- D <- H (master)
            \- E <- F <- G (new-feature)

            ||
            ||  (git rebase master; ...)
            ||
            \/

              (master)
A <- B <- C <- D <- H <- E' <- F' <- G' <- I (new-feature)

            ||
            ||  (git checkout master; git merge new-feature)
            ||
            \/

                                             (master) 
A <- B <- C <- D <- H <- E' <- F' <- G' <- I (new-feature)

Is easier to manage than

A <- B <- C <- D <- H (master)
            \- E <- F <- G (new-feature)

            ||
            || (git merge master; ... git checkout master; git merge new-feature)
            ||
            \/

A <- B <- C <- D <- H --------- J (master)
          \            \       /
            \- E <- F <- G <- I (new-feature)

Git logs

  • Use them to communicate to the team.

  • Use them as a place to keep notes and write down your thoughts.

  • My favorite:

    git log --graph --oneline --all --decorate
    

Remotes

A remote is simple: another repository ...ANYWHERE...

From Git SCM on remotes

It is entirely possible that you can be working with a “remote” repository
that is, in fact, on the same host you are. The word “remote” does not
necessarily imply that the repository is somewhere else on the network or
Internet, only that it is elsewhere. Working with such a remote repository
would still involve all the standard pushing, pulling and fetching operations
as with any other remote.

Remotes allow you copy a git tree from one repository to another.

Remote branches

A remote branch is completely independent of your local branches. Use git branch -a to list all available branches.

What really happens when you pull (abridged)

  1. git fetch
  2. git merge origin/<branch>

Resources

teamgit's People

Contributors

daricem avatar egriff38 avatar kinseyatkolla avatar thenerd247 avatar

Watchers

 avatar

teamgit's Issues

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.