Giter Club home page Giter Club logo

git-p's Introduction

Draft

How to Get Started with Somebody else's GitHub Repository

  1. fork the repo you want to work on by clicking "fork"
  2. clone the repo to your desktop. In your terminal, type the following: git clone --recursive https://github.com/YOUR_USERNAME/REPOSITORY_NAME.git
  3. set up a remote named origin. In your terminal, type the following: git remote add origin https://github.com/YOUR_USERNAME/REPOSITORY_NAME.git
  4. set up a remote named remote. In your terminal, type the following: git remote add origin https://github.com/OWNER_USERNAME/REPOSITORY_NAME.git
  5. run git remote -v to check the status of your remote setup. You should see the following:

origin https://github.com/YOUR_USERNAME/REPOSITORY_NAME.git (fetch)

origin https://github.com/YOUR_USERNAME/REPOSITORY_NAME.git (push)

upstream https://github.com/OWNER_USERNAME/REPOSITORY_NAME.git (fetch)

upstream https://github.com/OWNER_USERNAME/REPOSITORY_NAME.git (push)

Basic Workflow for Contributing/Developing a New Feature

  1. Make sure to be on your master branch.
  • To check which branch your currently on: git branch

  • To go to your master branch: git checkout master

  1. Update your local master branch to be in sync with the upstream master branch repository: git pull upstream master

NOTE: If there are confilicts, resolve them.

  1. Review the changes and ensure they are satisfactory (run and test the project)
  2. Push this to your remote origin repository: git push origin master
  3. Go to a branch to develop a new feature:
  • To switch to an existing branch: git checkout existing_branch_name

  • To create a new branch and switch to that branch: git branch -b new_branch_name

  1. Sync your new branch with your master branch: git merge master
  2. Develop a new feature
  3. Go back to your master branch (once you are sure that your current branch is good and ready to be put into master)
  4. Merge the branch you worked on with your master branch: git merge your_branch_name
  5. Push this to your remote origin repository: git push origin master

Branching

  1. Why use branches?

by diverging from the main line of development, you can continue to do work without messing with that main line.

Useful Commands for Branching

  • To create a new branch: git branch new_branch_name

  • To create a new branch and switch to that branch: git branch -b new_branch_name

  • To list all your remotes: git remote -v

  • to change remote's URL: git remote set-url REMOTE_NAME NEW_URL

NOTE

  • You need to commit your changes or stash them before you can switch branches; otherwise, your local changes will be overwritten.
  • git pull upstream master is same as git fetch upstream + git merge upstream/master

A LIST OF USEFUL COMMANDS

  • To change a remote's URL: git remote set-url origin https://github.com/USERNAME/REPOSITORY.git or git remote set-url origin [email protected]:USERNAME/REPOSITORY.git
  • To find out the exact commit that made an unwanted change: git bisect A_KNOWN_GOOD_COMMIT_ID ...To be added

git-p's People

Contributors

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