what is Git?

Git is a version control software used to manage documents and source-code of a software program over time and between people. As we know that the software changes with time with many updates and BUG fixes. Sometimes it happens such that the latest changes implemented in a source-code makes it completely unusable, and if the copy of the previous working code is not kept safely, all the work is in vain.

Continue Reading…

renaming master branch in git

I have master branch as default branch in github repository. I need two more branches called, ics and froyo, and I want to rename my master branch to ics.

first create two new branches

git branch froyo 
git branch ics 

now rename the =master= branch to =ics=

git branch -M -a master froyo

-M will rename the branch even if the new branch name already exists.

also I want to remove =master= branch from remote.

git push origin :master

Now if I want to set the default branch as ics on github, then login to github. Visit the repository, go to the Admin tab. In the Settings column, Change the Default branch from master to ics.


  1. to clone specific branch from git repository
    git clone -b BRANCH_NAME git@github.com:USER/REPOSITORY.git

    for example,

    git clone -b my-branch git@github.com:androportal/installer.git
  2. copy file from another branch

    for example,

    git co froyo html2sphinx.sh
  3. to checkout particular branch from remotes
    git co -b BRANCH remotes/origin/BRANCH

    for example,

    git co -b froyo remotes/origin/froyo
  4. to remove files from git which are already deleted from system
    for file in $(git ls-files --deleted); do git rm $file; done