Tuesday, 30 December 2014

GIT COMMANDS

Git is a distributed version control system with an emphasis on speed, data integrity and support for distributed and non linear work flows.

Below are some of the popular commands:


git status   # changed file in your working directory

git add .   #Add all changes to the next commit

git diff    #changes to tracked files

git branch <new branch>  # create a new branch based on your current head

git branch -d <branch>  #Delete a local branch

git pull --all

git log

git branch   # list all the existing branch

git stash

     git stash apply     # apply last stashed changes to working dir

     git stash list          # see your stashed changes

     git stash apply stash@{2}    # apply specific stashed changes.

git remote show origin          #to see the repository url


git reset HEAD^                  # remove commit locally
git push origin +HEAD       # force-push the new HEAD commit