HostOnNet Blog

Category Archives: Git

Show Git Branch in Command Prompt

To show current active git branch in command prompt in linux terminal, edit ~/.bashrc Add following


git diff

git diff command shows changes in current git repo. To see list of changed files between 2 commits, run Example $ git diff –name-only d523abc16fd26f3f269f99a1de623350e6f76d82 10a95d424540eb90ce94f214a25b7b4976c2284b app/Http/Controllers/ImportController.php app/Http/Controllers/MailController.php app/Http/Controllers/MailingListController.php app/Http/Controllers/SettingsController.php app/Http/routes.php app/MailingLists.php database/migrations/2017_04_19_040237_drop_queues_table.php database/migrations/2017_04_20_045005_create_mailing_lists_table.php database/migrations/2017_04_20_045614_alter_mailing_list_table.php resources/views/import/index.blade.php resources/views/layouts/master.blade.php resources/views/mail/index.blade.php resources/views/mail/mail.blade.php resources/views/mailing_list/index.blade.php


Install git from source

Download latest Git Source code from https://github.com/git/git/releases to install, run


Git

On a web server, i had to change file permission to 755 to make site work. Now when i try to get latest code from git, git pull fail with file change error. To ignore file permission in git, run


GIT fatal: Unable to find remote helper for ‘https’

On a CentOS 6 server, when cloning repo from GIT, i got following error root@server48 [~]# git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle Cloning into /root/.vim/bundle/vundle… fatal: Unable to find remote helper for ‘https’ root@server48 [~]# This is because git was installed from


GIT Disable accidental commit on master branch

To disable accidental commit on master branch, create file In your git repository root directory with following content Make this file executable Now commit on master branch won’t be allowed.


Better git log

Better Git Log To get better git log, run command Git Alias You can make an alias with command Now to view git log in new format, run


How to discard local commits in Git without local directory deletion or redownload

I have modified something in my local branch and but the changes not looking good. So I just tried by pulling the files from remote server using following command git pull origin master Nothing has happend and my local branch


Install GitWeb to work with Gitosis Installation

First create a virtual host for gitweb in apache DocumentRoot /home/gitweb.bizhat.com/public_html/ ServerName gitweb.bizhat.com CustomLog /var/log/httpd/gitweb.bizhat.com.log combined AddHandler cgi-script .cgi DirectoryIndex gitweb.cgi AllowOverride All Options All Order allow,deny Allow from all RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*


Symfony 2 Migration to Git

Symfony is a PHP RAD framework like Zend Framework, CakePHP, etc… They have been using subversion for version control. Today while checking language section of github.com, i found Symfony version 2 is using git for source control. See the announcement