Code Monkey home page Code Monkey logo

githelp's Introduction

GIT Help

Create new Feature branch and push to GitHub

$ git checkout -b Feature1

$ git push origin Feature1

Now create a Dev branch on the Feature branch

$ git checkout Feature1
$ git checkout -b Dev1 Feature1

A. Do work in Dev1 and move it to github for a PR

# While on the Dev1 branch
$ git commit -am "First developer update to feature"
$ git push -u origin Dev1

B. Do work in Dev1 then move those into Feature1

# While on the Dev1 branch
$ git commit -am "First developer update to feature"

# Now merge your changes to Feature1 without a fast-forward
$ git checkout Feature1
$ git merge --no-ff Dev1

Changes in Feature1 branch to roll down to Dev1

$ git checkout Dev1
$ git merge --no-ff Feature1

Now push the changes back out to GitHub

$ git push origin Feature1
$ git push origin Dev1

Delete a branch

#Delete a branch on your local filesystem :
$ git branch -d Dev1

# To force the deletion of local branch on your filesystem :
$ git branch -D [name_of_your_new_branch]

#Delete the branch on github :
$ git push origin :[name_of_your_new_branch]

Remote Branches

Clone the repo

$ git clone git://example.com/myproject
$ cd myproject

Look at all the branches

$ git branch -a
* master
  remotes/origin/HEAD
  remotes/origin/master
  remotes/origin/v1.0-stable
  remotes/origin/experimental

To work on a remote branch

$ git checkout experimental

That last line throws some people: "New branch" - huh? What it really means is that the branch is taken from the index and created locally for you. The previous line is actually more informative as it tells you that the branch is being set up to track the remote branch, which usually means the origin/branch_name branch

Now, if you look at your local branches, this is what you'll see:

$ git branch
* experimental
  master

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.