Wednesday, December 7, 2011

Git Simple commands

Like other repository managers CVS, git is a also a repository manager. Where we can commit our code, so that it can be updated in repository.

Branches : Whole repository can be managed using two branches : local  and remote branches. Master is the root of all branches where all builds from different branches are committed and are in production version. Local branches are the branches specific for particular project. Remote branches are the branches specific to particular project but not created by us.

Useful git commands :

#git push origin branch-name : push the code to specified branch
#git branch : will show your current branch
#git branch  -a :show list of all branches including remote and local and master branches
#git branch -r : show list of all remote branches.
#git stash : save your local changes into git pull or git svn (so that whenever you git pull --rebase changes will automatically comes in)
#git checkout <branch_name> : To switch to specified branch
#git pull --rebase : pull the updated build from current branch
#git logs : to check the last updates in repository
#gitk : is an Graphical interface to git.
#git status : How many local changes you have made.
#git diff <filename> : shows the differences of changes you have made in that file after last commit/update.
#git branch <branch_name> : create a new branch with <branch_name>

Note for more details refer link

No comments:

Post a Comment