Coder Social home page Coder Social logo

git-flow's Introduction

A git flow introduction

Ordniary flow

When everything works perfectly

Clone a repository

git clone https://github.com/klauszhang/git-flow

Checkout to a new branch

git checkout -b my-branch

while repace my-branch to your branch name

Commit your change

I personally using a GUI tool to performe this step. If not, please try

git add .
git commit -m "message add here"

Push to remote

git push

Avoid conflicts

  • Working on different things/files/features
  • Create PR ASAP, so that other people know what you're working on
  • Small commits, small changes will make resolving conflicts much easier

How to resolve conflicts

TALK TO OTHER PEOPLE FIRST TO UNDERSTAND WHAT THEY DID There's two ways to resolve conflicts git merge git rebase

Git merge

  • Will include other people's change into your branch, but looks clean on Github

Git rebase

  • Will make your git log nice and clean, but it is really hard to carry out when there's a big PR
  • Have to do git push -f

Collaborate

A demo of using PR to manage multiple people work on the same target

  • Create a base branch by git checkout -b feature1
  • Push to remote and create a PR target to master
  • For each collaborator, create their sub-branch by:
    • checkout to feature1 branch first
    • checkout to a new branch by git checkout -b feature1-sub1
    • push to remote and create a PR, target to feature1
  • Work on each branch and get each PR reviewed and merged
  • After all the work have been done, merge main branch into master

Update from master

  • Click on update button on PR on feature1 PR
  • Click on update button on PR on each sub feature PR

Confict resolution

TALK TO OTHER PEOPLE FIRST TO UNDERSTAND WHAT THEY DID

Start to resolve conflicts via your favourite tools

Useful git tools

git stash

This will allow to save your current WIP into a safe place so that you can use them in future, especially useful when you're working on multiple branches.

git cherry-pick

This will allow you to pick the commit from other branches, useful to recover work from other branches

git log

Useful to see what's the current status of work.

The end

git-flow's People

Contributors

klauszhang avatar jasminelightbox avatar kirthikalightbox 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.