Git Product home page Git Product logo

git_tutorial's Introduction

Find The Version Of Git

git --version

Create A New Git Repository

  1. Go to the fold of the project.

  2. Run git init

Clone An Existing Git Repository

Cloning is the process of pulling down a copy of a repository stored on a server.

  1. Go to the parent folder of where you want to repository's folder to be in.

  2. git clone [url to repository's git file] [name of folder / repository you want]

Check The Status Of A Git Repository

git status

Tell Git To Track A File

git add readme.md

Make A Commit

git commit --m "First commit"

Tell Git To Track A Whole Folder

git add chapter2/

Tell Git To Track (And Stage) All Files And Subfolders In A Directory

git add -A

View All Branches

git branch

Create A New Branch

git branch new_model

Switch To A Branch

git checkout new_model

Create A New Branch And Switch To It

git checkout -b new_ux

Merge One Branch Into Another

  1. Switch to the branch you want to pull changes into: git checkout master

  2. Pull changes from another branch into your branch: git merge new_ux

Set A Remote Github Repository

  1. Go to GitHub.com and create a new repository.

  2. Set that repository's url as the origin repo: git remote add origin https://github.com/chrisalbon/git_tutorial.git

Push Master Branch To A Github Repository

The -u sets the origin as the default for this branch

git push -u origin master

Pull Down From A Branch From A GitHub Repository To Local Repository

git pull origin master

Pull Down All Branches From GitHub

git fetch origin

View All Remote Branches

git branch --remote

View Log

git log

View Unstagged Changes To Files

git diff

Unstage A File

git reset filename

Undo Last Commit, Move Commits Changes To Staging

git reset --soft HEAD^

Undo Last Commit, Remove All Changes In Your Working Directory

git reset --hard HEAD^

Clone A Remote Repository Locally

git clone url

Show Changes From A Particular Commit

git show --pretty="format:" <commitID>

Revert A Commit By Creating A New Commit With Opposite Changes

git revert <commitID>

git_tutorial's People

Contributors

chrisalbon avatar

Watchers

 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.