Friday 1 August 2014

Git Commands

Almost all git Commands for beginner :
Git command
Git clone:
This is used to import remote source code to local computer
so now you have code from repository. so what next?

Git status -s
used to see changes made in files. 

Git rm filename
To remove file.

Git add .
Add files into local branch.

Git commit
ex git commit -m "comment will goes here"
To make file ready to push

Git branch 
To check active branch

Git checkout "branchname"
 go to particular branch.

git merge :
git merge "branchname "
merge code to particular branch.

git push

git push origin " branch name "
pushes commits to remote branch. 

***Create new branch and go to that branch
git checkout -b "branchname"
Switched to a new branch "branchname"'
 
Alternate Way
 git branch branchname 
   This will creates the new branch.
 git checkout branchname
    Now Head will at new branch.
 
****Check branches which are not yet merged*****
git branch --no-merged
  
** mearge to master***
first go to master then merge branch which ever you want
git merge branchname

 
 
 

No comments:

Post a Comment