Giter Club home page Giter Club logo

howtogit's Introduction

HowToGit

Notes: A bunch of usefuly gitcommands

Git workflow

(1) git clone or git pull --> (2) (making changes) git add, git mv, git rm, etc -->(3) git commit -->(4) git pull, git merge -->(5) git push

#Usefull Git commands

$ git log          //shows all the commits that have been made to repo $ git status          //shows any pending changing in the repo waiting to be commited
$ git checkout -f          //Go back to the last working branch and the -f flag force overwrites
$ git push origin NameOfBranch          //push your commited code to branch
$ git pull          //pull the most up to date branch from github
$ git checkout BranchName          //Change to BranchName
$ git checkout -b BranchName        //create a new branch with the name BranchName and-b command flag means new $ git branch          //check what branch you are on and what other branches are avaible
$ git mv OldFile.rdoc NewFile.md          //change the name of a file
$ git commit -a -m "Improve the README file"    //shortcut add, DO NOT USE if you added new files
$ git branch -d BranchName      //delete a branch with the name BranchName

#Setup up your config settings $ git config --global user.name "Your Name"          //Setup Name
$ git config --global user.email [email protected]          //Setup email
$ git config --global push.default matching          //ensure forward-compatibility with an upcoming releases
$ git config --global alias.co checkout          //Short cut to make checkout to co

#Starting a new repo In this case you created a repo online and you want to clone it to your workspace.

$ git clone https://USERNAME:[email protected]/OWNER/REPO_NAME.git workspace
USERNAME with your GitHub username;
PASSWORD with your GitHub password;
OWNER with the username of the person who owns the repository;
REPO_NAME with the name of your project’s repository; and
workspace with the name for your workspace directory. Although optional, we will specify it here to create the workspace directory.

#Starting a local Repo Go to the home folder of the project on the terminal

$ git init
$ git add -A          //Adds all files to be commited
$ git commit -a          //Adds all unstaged files and commits at the same time
$ git commit -m "Initialize repository"          //Commits all files with -m flag to write a comment

To push the local Repo to a github repo

$ git remote add origin https://github.com/USERNAME/NAMEOFREPO.git
$ git push -u origin master

howtogit's People

Contributors

dspaces1 avatar yh-hackerguides avatar

Watchers

 avatar  avatar  avatar

Forkers

oliviaross

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.