Some usefull command for GIT

Share It!

GitHub is an online Git storehouse facilitating administration, which offers the version control like SVN and source code administration (SCM) usefulness of Git and additionally including its own components.


Here are helpful commands which will give you overview to use while using Git a version control..

1) git branch -> It will show you the list of branch(es)

 example: $ git branch
  output: * master

2) git diff /path/to/file -> It will display the difference for mentioned file

 example: $ git diff /usr/local/apache2/htdocs/abc.php

diff --git a/usr/local/apache2/htdocs/abc.php b/usr/local/apache2/htdocs/abc.php
index 046ac32..7e3e19d 100755
--- a/usr/local/apache2/htdocs/abc.php
+++ b/usr/local/apache2/htdocs/abc.php
@@ -45,9 +45,10 @@ class loginUser extends User {
     public function getDataforUser($query, $searchParam) {
-            $query->andWhere('u.firstname LIKE :firstname OR u.lastname LIKE :lastname OR LIKE :country')
+            $query->andWhere('u.firstname LIKE :firstname OR u.lastname LIKE :lastname OR LIKE :country OR l.ipAddress LIKE :ip ')
                     ->setParameter('firstname', '%' . $searchParam['search'] . '%')
                     ->setParameter('lastname', '%' . $searchParam['search'] . '%')
                     ->setParameter('country', '%' . $searchParam['search'] . '%');
             return $query;

3) git add filename -> It will add file to commit list

 example: $ git add /usr/local/apache2/htdocs/abc.php

4) git up -> It will fetch changes

 example: $ git up

5) git push -> It will push the code to repository

 example: $ git push

6) git push orgin branchname -> It will push the change in to branch

 example: $ git push origin master

7) git fetch && git checkout branchname -> To checkout specific branch

 example: $ git checkout /src
 example: $ git fetch

Here are more exploration about Git.. Click here

Leave a Reply

Your email address will not be published.