Saturday 13 October 2018

Git Basic Commands

Today we will see some useful Git commands,

To check git version
$ git --version

To set config values
$ git config --global user.name "Manivel Rajendran"
$ git config --global user.email "example@gmail.com"

 
To list config values
$ git config --list
 
To reset the config values
$ rm ~/.gitconfig
 
To getting help with git
$ git help config

   Example :
      $ git config --help
      $ git add --help


Initialize the git
   $ git init

To check status of the file
   $ git status

Add files or folder from working area to staging area

        Add a file or folder  
           $ git add file_name

       Add all files or folder
           $ git add -A

Remove files or folder from working area to staging area

       Remove a file or folder
             $ git reset file_name

       Remove all files or folder
             $ git reset


Commit the change with message
   $ git commit -m "Initial Commit"

To view changes between commits
   $ git diff

To view commit log
   $ git log


List, Create, Merge and Delete branches

       To list the branch
           $ git branch

       To list all the branch (Local and Remote)
           $ git branch -a

       To create a branch
           $ git branch branch_name

       To change one branch to another
           $ git checkout branch_name
      
       To merge a branch with current branch
           $ git merge branch_name

       To check everything merged with current branch
           $ git branch --merged

       To delete branch on local
           $ git branch -d branch_name

       To delete branch on Remote
       $ git push origin --delete branch_name
  


Specifies untracked files in .gitignore

    $ vim .gitignore
         *.pyc
        .htaccess
        documents


Clone a repository into a new directory

     Clone from upstream
         $ git clone https://github.com/manivel23/repository.git  .
 

     Clone from local
          $ git clone  ../repository.git  .


Manage set of tracked repositories

       View remote repository info
            $ git remote -v

       To add a remote repository
            $ git remote add staging https://github.com/manivel23/repository.git

Pull and Push
     
      To pull latest commit remote repository to local
      $ git pull origin master

              origin --> name of the remote repository
              master --> name of the remote repostory branch
    
      To push latest commit local to remote
      $ git push origin master
 

      To push all branch local to remote
      $ git push --all origin
         
       To pull latest commit a specific brancha name from remote repository to local
        $ git pull -u orgin specific_branch_name
     
               -u  ---> set-upstream
   
To disable SSL verification
$git config --global http.sslverify "false"

1 comment:

  1. Coin Casino Review 2021 - Casinoowed.com
    Coin Casino Mobile 메리트카지노 App — There are a few aspects of this product — first of all, you're going to have to navigate through the homepage and pay 🏆 Coin Casino: Play Here!🥇 Best Overall Score: 9.7/10🤵 Minimum Deposit: $5📱 Mobile: Android,iPhone,iPad,Other Mobile🎡️ Casino App: Slots, Live Casino, Table Games🔝 All Games: 인카지노 400+⃣ Mobile Betting: 100+💰 Deposit Methods: Interac + 메리트 카지노 쿠폰 more

    ReplyDelete