• How to Clone a Git Repository, Create A New Branch & After Changes Push That Branch To Git & Merge The Branch.

    I have cloned 1 project from Git , created 1 branch called feature/ticket2 in local,made some changes ticket2 branch ,then pushed to github. After that you can see the ticket1 branch pushed to github. Then you can merge the ticket1 branch to master branch.
    Step1: Clone
                 open cmd & go to cd /Applications/MAMP/htdocs.
            git clone https://github.com/smita-debata/laravel.git

    Step 2: git branch

    step 3: create new branch & change your code in that branch.
                git checkout -b feature/ticket2

           Switched to a new branch 'feature/ticket2'

    Step 4: Then you can change your required files. Then you will commit that files .Then push to            github.

    Step 5: you can check which files has been changed by the following command.
            git status
            it will show you which files has been modified as follows. 
    modified:   hello.txt

    Step 6: then you have to add that file.
            git add hello.txt

    Step 7: After add you have to commit that file.
            git commit -m "committed ticket2"
            the text in "" is comments for reference.
            
    Step 8: Now you can check the status by git status 
    Step 9: Now push the file to Github
            git push origin feature/ticket2

    Step 10: Now open github. Open your repository which you have cloned.then go to 
             pull requests->New Pull Requests.
             Choose base & compare branch.
             Then create pull Request->Merge pull Request.
             Now you can check that the master branch is updated with latest code.

             
  • You might also like

    2 comments:

    1. Hi Smita , this blog helps a lot ...thanks for contributing urself to techies and who are in need of learning

      ReplyDelete