Sunday, 22 January 2017

How to Use Git Step by Step using Command line

For Example :  I am a developer  and my git Details is below.
User name : Harry
User Email : Harry@India.com ( Git Email)
Lets suppose I want to  work on TicketTool Branch. So TicketTool branch is live for me. I should not Modified TicketTool Files Directly. So We have to Create local Branch from TicketTool. Here we have created local branch issue-2 from TicketTool. Now we can modify any files in my local Branch( issue-2).
 Live Branch :-  TicketTool.
Local Branch:-  issue-2
If you want to initialize new clone/ Project Follow bellow Command.
 #Git global setup ( one Time only)
 git config --global user.name "Hari"
 git config --global user.email "Harry@india.com"
 git clone  http://ubuntu/harry/itsupport.git   // project url
  cd  MyProject    // project folder
   
# This command will use many times.
    git checkout TicketTool            // live Branch
    git pull            // Pull for latest update.   
    git checkout issue-2     // Working branch / local Branch.
    git merge TicketTool      // if your local live branch is already uptodated. Then Not Required.



//After Completing above 4 Command now we can start our work. When our work will done. Then we have to Run below commands.

    git add *   // mark all changes for commit
    git commit  // commit / save  project changes on your local machine.



// if you run above Two commands it means your Work is Committed ( Saved)  on your local system. but we have to push our work on git server. So we have to follow below commands once more.

    git checkout TicketTool                           
    git pull
    git checkout issue-2     // Working branch
    git merge TicketTool








// above 4 commands are used for taking latest update and merge into our local branch ( issue2).   Finaly here  is command to Push our work on git Server.

    git push issue-2

if you have pushed  your work successfully  on git server . now create merge request from web login. ( if required)

Anonymous

Author & Editor

A technology enthusiast and addictive blogger who likes to hacking tricks and wish to be the best White Hacket Hacker of the World.

1 comments:

Note: only a member of this blog may post a comment.