Git: Installation & Setup

Installation:

1) Ubuntu,debian
           sudo apt-get install git-core
2) Fedora,red hat
           yum install git
3) Windows
           http://code.google.com/p/msysgit/
4) Mac OS
           http://code.google.com/p/git-osx-installer 

Setting up Git:

When you first start using Git, there are a few things you will likely want to get setup before you start. Git records your name and email address when you create commits, so you need to tell Git what those are. 

You can use the git config command to set those. If you pass --globalit will save the values in the ‘~/.gitconfig’ file so they are the default for all of your repositories.

User Configuration:

          $ git config --global user.name "Your Name" 
          $ git config --global user.email "YourMail@gmail.com"

Push configuration:

The following command configure Git so that the git push command pushes always all branches which are connected to a remote branch (configured as remote tracking branches) to your Git remote repository. This makes is typical easier to ensure that all relevant branches are pushed.

# set default so that all changes are always pushed to the repository 
         $ git config --global push.default "matching"

Avoid merge commits for pulling:

If you pull in changes from a remote repository, Git by default creates merge commits. This typically undesired and you can avoid this via the following setting.

# set default so that you avoid unnecessary commits 
        $ git config --global branch.autosetuprebase always

Color Highlighting:

       $ git config --global color.ui true 
       $ git config --global color.status auto 
       $ git config --global color.branch auto

Setting the default editor:


       $  git config --global core.editor vim

No comments:

Post a Comment