Monday, August 10, 2015

Installing GIT on your local ubuntu machine and some basic commands

Step 1: sudo apt-get install git-core //Installs git tool in your local ubuntu machine.

Step 2: //Checking GIT version

git --version
---> git version 1.9.1


Step 3: Setting User Name and EMail Id:

  git config --global user.name "Aditya Hegde"
  git config --global user.email "abc@gmail.com"


List of other git commands:
1.  AVOID MERGE COMMITS FOR PULLING
// You pull latest changes from a remote repository and if these changes are divergent then, by default Git creates merge commits. We can avoid this via following settings.

* git config --global branch.autosetuprebase always


2. COLOR HIGHLIGHTING
  // The following commands enable color highlighting for Git in the console.
  * git config --global color.ui true
  * git config --global color.status auto
  * git config --global color.branch auto

3. SETTING DEFAULT EDITOR
// By default Git uses the system default editor which is taken from the VISUAL or EDITOR environment variable. We can configure a different one by using git config.
  * git config --global core.editor vim

4. SETTING DEFAULT MERGE TOOL
// Git does not provide a default merge tool for integrating conflicting changes into your working tree. We can set default merge tool by enabling following settings.
  * git config --global merge.tool vimdiff

5. LISTING GIT SETTINGS
// To verify your Git settings of the local repository use git config –list command as given below.
  * git config --list


Creating Operation:

A. Creating New Group and User
1. Creating a Group:
   * groupaddgroup-name

2. Adding new user to group
   * useradd -G group-name -d /home/gituser -m -s /bin/bash username

3. Changing the password for user:
   * passwd user-name
  // This will prompt for new password

B. Creating Bare Repository:
1.  Create a directory with .git extension
    * mkdir directory_name.git

2. Switch to newly created directory.
   * cd directory_name.git

3. // Initializing new empty repository with --bare option
  *  git --bare init
-----> Initialized empty Git repository in /home/gituser/project.git/






No comments:

Post a Comment