GithubHelp home page GithubHelp logo

github-git-commands's Introduction

Github-git-commands

##Simple git Cheatsheet

  • repo -> repository
  • clone -> bring a repo down from the internet (remote repository like Github) to your local machine
  • add -> track your files and changes with Git
  • commit -> save your changes into Git
  • push -> push your changes to your remote repo on Github (or another website)
  • pull -> pull changes down from the remote repo to your local machine

git config –global user.name “[name]” ->sets author name git config –global user.email “[email address]” ->sets author email id

git init [repository name] ->start new repository

git clone [url] ->obtain a repository from an existing URL.

git add [file] ->adds a file to the staging area.

git commit -m “[ Type in the commit message]” ->records or snapshots the file permanently in the version history. git commit -a ->commits any files you’ve changed since then.&commits any files you’ve added

git diff ->shows the file differences which are not yet staged. git diff –staged ->differences between the files in the staging area and the latest version present. git diff [first branch] [second branch] ->differences between the two branches mentioned.

git reset [file] ->unstages the file, but it preserves the file contents. git reset [commit] ->undoes all the commits after the specified commit and preserves the changes locally. git reset –hard [commit] ->discards all history and goes back to the specified commit.

git status ->command lists all the files that have to be committed.

9 ) git rm [file] ->deletes the file from your working directory and stages the deletion.

git log ->used to list the version history for the current branch. git log –follow[file] ->lists version history for a file, including the renaming of files also.

git show [commit] ->shows the metadata and content changes of the specified commit.

git tag [commitID] ->used to give tags to the specified commit.

git branch ->lists all the local branches in the current repository. git branch [branch name] -> creates a new branch. git branch -d [branch name] -> deletes the feature branch.

git checkout [branch name] -> used to switch from one branch to another git checkout -b [branch name] ->creates a new branch and also switches to it.

git merge [branch name] ->merges the specified branch’s history into the current branch.

git remote add [variable name] [Remote Server Link] ->used to connect your local repository to the remote server.

git push [variable name] master ->sends the committed changes of master branch to your remote repository. git push [variable name] [branch] ->sends the branch commits to your remote repository. git push –all [variable name] ->pushes all branches to your remote repository. git push [variable name] :[branch name] ->deletes a branch on your remote repository.

git pull [Repository Link] ->fetches and merges changes on the remote server to your working directory.

git stash save ->stores all the modified tracked files.

git stash pop ->restores the most recently stashed files. git stash list ->lists all stashed changesets. git stash drop ->discards the most recently stashed changeset. git checkout -b [name of the branch] -> to create a new branch git checkout [name of the branch] -> to navigate into the named branch git checkout -d [name of the branch] -> to delete the branch git merge [branch name] -> to merge the branch to current branch in working directory

github-git-commands's People

Contributors

exusnraul avatar

Watchers

 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.