Giter Site home page Giter Site logo

hs-git-cheat-sheet's Introduction

Git Cheat Sheet

Git got you freaked? It's normal. There are a lot of commands that have control over a lot of different actions. This is precisely why we never expect you to memorize anything. In fact, we're even providing you with a cheat sheet. It's not cheating when it's programming!

Creating A New Project From Scratch:

  1. Once you've created a directory that you want to track, initialize git with git init. Make sure your directory contains a README.md file.

  2. To set up your github.com directory:

  • Go to your profile on github.com.
  • Click on the + button on the top right of the page. Choose 'new repository'
  • Give your new repository the same name as your local project directory.
  • In your terminal, add the github repository as 'origin.' You should be able to copy this from the github page once you've save it: git remote add origin [email protected]:dfenjves/repository-name.git

To Push Work To GitHub:

  1. Check the status of your project with git status

  2. When you're working on a project and want to commit your code:

  • Use git add with the filename you want to to add to your 'holding station'
  • When you're ready to commit, git commit -m "add a message about the changes you've made
  • When you're ready to push to your repository on github.com: git push origin [branch name] (if it's the first time you do this, add the flag -u after git push)

To Create A New Branch:

  1. To create and switch to a new branch use git checkout -b [branch_name]

  2. To switch to an existing branch use git checkout [branch_name]

To Merge A Branch Into Master:

  1. git checkout master to switch into your master branch
  2. git merge [other-branch]
  3. (optional) push to github using git push

To Copy An Existing Repository To Your Computer:

  1. Go to the repository page on github.com
  2. Click on the fork button on the top right of the screen.
  3. Copy the SSH clone link on the right side of the new page.
  4. Navigate to the development folder in your terminal and type git clone [copied_text]
  5. cd into the folder you downloaded on your computer.

View Git Cheat Sheet on Learn.co and start learning to code for free.

hs-git-cheat-sheet's People

Contributors

victhevenot avatar

Watchers

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