Giter Club home page Giter Club logo

githubcheatsheet's Introduction

Github Cheatsheet

This assumes that you already know how Git works. I've written down how to do a few of the things that I do over and over again. Feel free to add your own / update the existing instructions.

Adding a branch to my repository, based on a remote repository:

git fetch https://github.com/drivechain-project/mainchain
git checkout -b upstream FETCH_HEAD
git push -u origin upstream

Copy a branch from upstream repository into my fork:

git remote add upstream https://github.com/drivechain-project/bitcoin
git fetch upstream
git checkout -b newBranch upstream/mainchainTravis
git push -u origin newBranch

Updating a branch in my repository, from an upstream repository:

git fetch
git checkout fees  // the branch I want to update
git fetch https://github.com/drivechain-project/sidechain
git merge FETCH_HEAD fees
git push -u origin fees

Create a new branch, from an existing branch in my repository:

git checkout -b newbranch existingbranch

Amend a new commit into the last one, for a fix:

git add .
git commit --amend
git push -u --force origin nolibm

Checkout a commit from a repository into a new local branch:

git fetch https://github.com/bitcoin/bitcoin 18c1325dcdb2eb2f2119bd558c111ed439038cc6:newBranch

Rebase a pull request:

git remote add upstream https://github.com/bitcoin/bitcoin
git fetch upstream
squash if you want to:
git rebase -i HEAD~nCommitsToSquash
git push -u origin rebase

Cleanup a bunch of commits:

Make a branch based on the branch you want to cleanup with the sha256 of the commit before you started adding things.

git fetch https://github.com/bitcoin/bitcoin sha256:newBranch

upload the branch

git push -u origin newbranch

Go on to github and make a pull request from the old branch with the changes, into the new branch before the changes.

Use github.com to squash and merge

githubcheatsheet's People

Contributors

cryptaxe avatar

Watchers

cryptobangdang 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.